rspack
rspack copied to clipboard
[SwcJsMinimizerRspackPlugin] Alignment with terser-webpack-plugin for format.comments
What subject does this issue tracking?
The current implementation of the SwcJsMinimizerRspackPlugin format.comments (https://rspack.dev/plugins/rspack/swc-js-minimizer-rspack-plugin) does not allow regex to be used like https://webpack.js.org/plugins/terser-webpack-plugin/#preserve-comments
new TerserPlugin({
terserOptions: {
format: {
comments: /@.* [\w|\d].*|==\/?UserScript==/i
}
}
})
it instead requires either comments?: false | 'some' | 'all';, would like to propose supporting a regex so that certain comments will be left untouched when using SwcJsMinimizerRspackPlugin as a minimizer
This feature can be sent to swc repository as well
Closes as https://github.com/swc-project/swc/pull/10571