javascript - Final generated jsBundle file compression problem
迷茫
迷茫 2017-07-05 10:54:19
0
2
762

If you write in the project webpack.config.js

file
        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?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
大家讲道理

The compressed jsBundle cannot be loaded because you need to add a banner that weex can recognize
If 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
})
伊谢尔伦

If you use Vue for development, you need to keep { "framework": "Vue" } from being compressed, just like what was said above.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template