-
-
Notifications
You must be signed in to change notification settings - Fork 595
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rspack_plugin_swc_js_minimizer): add minify option
- Loading branch information
Showing
15 changed files
with
66 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/rspack-test-tools/tests/configCases/plugins/minify-disable-minify/a.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const a = process.env.a; | ||
const b = process.env.b; | ||
|
||
console.log(a + b); |
9 changes: 9 additions & 0 deletions
9
packages/rspack-test-tools/tests/configCases/plugins/minify-disable-minify/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
it("[minify-disable-minify]: should not minify code", () => { | ||
const content = fs.readFileSync(path.resolve(__dirname, "a.js"), "utf-8"); | ||
|
||
expect(content).toContain("let a = process.env.a;"); | ||
expect(content).toContain("console.log(a + process.env.b);"); | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/rspack-test-tools/tests/configCases/plugins/minify-disable-minify/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const rspack = require("@rspack/core"); | ||
/** | ||
* @type {import("@rspack/core").Configuration} | ||
*/ | ||
module.exports = { | ||
entry: { | ||
a: "./a", | ||
main: "./index" | ||
}, | ||
output: { | ||
filename: "[name].js" | ||
}, | ||
optimization: { | ||
minimize: true | ||
}, | ||
plugins: [ | ||
new rspack.SwcJsMinimizerRspackPlugin({ | ||
minify: false, | ||
minimizerOptions: { | ||
mangle: false | ||
} | ||
}) | ||
] | ||
}; |
6 changes: 6 additions & 0 deletions
6
packages/rspack-test-tools/tests/configCases/plugins/minify-disable-minify/test.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @type {import("../../../../dist").TConfigCaseConfig} */ | ||
module.exports = { | ||
findBundle: (i, options) => { | ||
return ["main.js"]; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters