-
-
Notifications
You must be signed in to change notification settings - Fork 199
Description
Once enableVueLoader()
is used, the production file will contain blocks of unnecessary comments generated during the compilation, such as this:
!*** ./assets/js/App.vue ***!
\***************************/
/*! exports provided: default */
/*! exports used: default */
/*! !../../node_modules/extract-text-webpack-plugin/dist/loader.js?{"omit":1,"remove":true}!vue-style-loader!css-loader?{"minimize":true,"sourceMap":false,"importLoaders":0}!../../node_modules/vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-5959c6ce","scoped":false,"hasInlineConfig":false}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./App.vue */"cDz4")}var i=n(/*! !babel-loader?{"cacheDirectory":true,"presets":[["env",{"modules":false,"targets":{"browsers":"> 1%","uglify":true},"useBuiltIns":true}]]}!../../node_modules/vue-loader/lib/selector?type=script&index=0!./App.vue */"W56x"),o=n(/*! !../../node_modules/vue-loader/lib/template-compiler/index?{"id":"data-v-5959c6ce","hasScoped":false}!../../node_modules/vue-loader/lib/selector?type=template&index=0!./App.vue */
Even when tested with simple .js
files, similar comments will be included in the production file.
No idea what causes this. Since such comments have the default format of banners, Encore's default setting would allow them to stay in the production files.
In a Vue project with many components, the file would become quite bloated.
My current fix is to override the default setting of UglifyJsPlugin
, either using comments: false
or extractComments: true
.
But they are not real solutions: comments: false
would remove all comments including real banners (which makes me feel bad), while extractComments: true
would include many useless comments in a license file.
Is there a better solution? Thanks.