I am building an ionic 4 app and using class names references in the local offline pouch DB it works fine. But when I make the Prod build with optimization true it shortens the classes to single alphabet name -
e extends ia { constructor(){super(),this.isActive=!0 }}
I have used custom-webpack for keeping the class name with the following code -
module.exports = cfg => {
const options = cfg.optimization.minimizer[cfg.optimization.minimizer.length - 1].options.terserOptions;
if (options) {
options.keep_classnames = true;
}
return cfg;
};
It works fine for ionic serve --configration prod
but not for ionic build --configuration prod
I want to keep class names for ionic build --configration prod
with optimization:true
.
Please help thanks.
You can specify the TerserWebpackPlugin to keep the class names.
module.exports = {
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
keep_classnames: true,
keep_fnames: true,
},
}),
],
},
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.