About keep classname in minified file #14526
woshiguabi
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
Thanks for the suggestion. The compiler assumption is meant to output less code, not more. So we won't consider the proposed assumption, especially Babel already outputs code that preserve class names. If you want to debug your app, you can disable terser and generate a debug build. Even with source map support, the debugger experience from the minified code is still limited compared to unminified debug build. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
By default, it compiles to
But after
terser
minified, the class name will be lost.Sometimes we want to keep the class name for hints. Such as
react
andvue-class-component
.After compile and minified, in vue devtools will lost the name.(same in react devtools)
And if the minified name conflicts with html built-in tag name, such as
<a>
<b>
<i>
, will get a console error inVue
I try to use
terser
options, but still have some problems:keep_classnames
won't work because after compile there are no classes, just function.keep_fnames
will keep all function name, includes the normal function.So this problem can only be solved in
babel
.Suggestion
Add a assumption
setClassName
to pass original class name to_createClass
.And in
_createClass
define a property to classWe can do some compatibility work to keep performance when
setClassName
not be enabled.Beta Was this translation helpful? Give feedback.
All reactions