-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose
keepFnNames
and keepClassNames
options of builtin sw…
…c minfier (#4121) * feat(minfier): expose keepFnNames and keepClassNames options of builtin swc minfier * chore: change keep_class_names, keep_fn_names, and changed tests use field name * chore: remove unused code * Update crates/rspack_testing/test.config.scheme.json * Update crates/rspack_testing/test.config.scheme.json * chore: update snap * Apply suggestions from code review * chore: update snap * chore: format codebase --------- Co-authored-by: Hana <[email protected]>
- Loading branch information
1 parent
e1df35d
commit 14ded15
Showing
12 changed files
with
82 additions
and
22 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
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
6 changes: 6 additions & 0 deletions
6
packages/rspack/tests/configCases/builtins/minify-keep-classnames/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,6 @@ | ||
class KeepClass {} | ||
|
||
it("should keep class names", () => { | ||
const name = KeepClass.name; | ||
expect(name).toBe("KeepClass"); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/rspack/tests/configCases/builtins/minify-keep-classnames/webpack.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,10 @@ | ||
module.exports = { | ||
builtins: { | ||
minifyOptions: { | ||
keepClassNames: true | ||
} | ||
}, | ||
optimization: { | ||
minimize: true | ||
} | ||
}; |
6 changes: 6 additions & 0 deletions
6
packages/rspack/tests/configCases/builtins/minify-keep-fn-names/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,6 @@ | ||
function main() {} | ||
|
||
it("should keep fn names", () => { | ||
const name = main.name; | ||
expect(name).toBe("main"); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/rspack/tests/configCases/builtins/minify-keep-fn-names/webpack.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,10 @@ | ||
module.exports = { | ||
builtins: { | ||
minifyOptions: { | ||
keepFnNames: true | ||
} | ||
}, | ||
optimization: { | ||
minimize: true | ||
} | ||
}; |