-
-
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 (#7599)
* feat(rspack_plugin_swc_js_minimizer): add minify option * fix: move minify field * fix: api
- Loading branch information
Showing
12 changed files
with
57 additions
and
8 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
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({ | ||
minimizerOptions: { | ||
minify: false, | ||
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
c483c0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
c483c0e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open