If you write in the project
webpack.config.js
plugins: [bannerPlugin,
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
The size of the jsBundle file generated by such packaging is 50% smaller, but the problem is that the app cannot load such a jsBundle file. Is there any relevant solution?
大家讲道理2017-07-05 10:56:19
The compressed jsBundle cannot be loaded because you need to add a banner that weex can recognizeIf you use Vue for development, you need to keep { "framework": "Vue" }
// code compression plug-in
The code is as follows
var optimizePlugin = new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
//保留banner
comments: /{ "framework": "Vue" }/,
sourceMap: true
})
伊谢尔伦2017-07-05 10:56:19
If you use Vue
for development, you need to keep { "framework": "Vue" }
from being compressed, just like what was said above.