-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class name change when the file is minified #1118
Comments
UglifyJS plugin is used to perform minification during production builds via the uglifyjs-webpack-plugin. You can override/modify the settings using the vue.config.js as specified in the docs. I would refer to the UglifyJS Mangle Options to see how you might prevent mangling properties in specific scenarios. You can pass UglifyJS options into the webpack plugin via the |
I did it and worked perfectly. Thank you @dhensche ! Unfortunately, the file size has increased from 880.89 kb to 1291.50 kb.
|
@ftgibran If you're just concerned with class names, and want to minimize file size, can you just set the option |
Tried these vuejs/vue-cli#1118 https://medium.com/haiiro-io/element-component-name-with-vue-class-component-f3b435656561 with no success. Must find a more correct way to do this.
hello!
|
if anyone is still looking for this.
|
Thanks for that hing @djpate this made my day after 2 hours debugging an issue that only happened in production build, not in dev mode... module.exports = {
chainWebpack: config => {
config.optimization
.minimizer('terser')
.tap(args => {
const { terserOptions } = args[0]
terserOptions.keep_classnames = /.*ClassNameThatIWantToKeep.*/
terserOptions.keep_fnames = /.*ClassNameThatIWantToKeep.*/
return args
})
}
}``` |
Version
3.0.0-beta.6
Reproduction link
https://codesandbox.io/s/vnq0v2w8z3
Steps to reproduce
Create any class and print its name by using constructor.name then reproduce it in production mode.
What is expected?
Prints the correct class name.
What is actually happening?
It prints a letter instead of the class name.
Probably it happens because of the file is minified in production mode.
The text was updated successfully, but these errors were encountered: