Open andrewtimberlake opened 1 year ago
Embroider uses hardcoded options for terser so I don't think it's possible to configure terser at the moment.
I assume we could make it possible by adding a new terserOptions
/ minifierOptions
object to the available Webpack options which would then be merged with the Embroider terser options before being passed into terser?
Which would then look like this in apps:
return require('@embroider/compat').compatBuild(app, Webpack, {
packagerOptions: {
terserOptions: {
compress: {
drop_console: true,
}
}
}
});
That is correct but also it's important to note that our direct use of terser is only for the legacy scripts (so vendor.js
).
All the rest of your app and addons goes through webpack's minification, so you can adjust all the minification options by passing them in the webpack config.
Thanks, that worked. I did the following:
const TerserPlugin = require('terser-webpack-plugin');
//…
const { Webpack } = require('@embroider/webpack');
return require('@embroider/compat').compatBuild(app, Webpack, {
packagerOptions: {
webpackConfig: {
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: true,
},
},
}),
],
},
},
},
});
Because embroider is not using ember-cli-terser, I’m not sure how to set the
drop_console
option. Before embroider I had the following in ember-cli-build.jsIs it possible to set that option via embroider?