默认情况下,vue-cli将node_modules
中找到的所有模块提取到单个文件vendor.js中。这是插件代码
// keep module.id stable when vender modules does not change
new webpack.HashedModuleIdsPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function(module, count) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
chunks: ['vendor']
}),
我想为每个图书馆提供自己的文件。原因是我试图让一个抽搐延期批准,并且他们对#34;混淆代码非常严格"。有人告诉我,如果每个图书馆都在自己的文件中,那么审查过程会有所帮助。
所以,如果我使用vue,vue-router和vuex。我想从
开始<script type="text/javascript" src="static/js/vendor.27baea56fa1d6f323c7b.js"></script>
到此
<script type="text/javascript" src="static/js/vue.27baea56fa1d6f323c7b.js"></script>
<script type="text/javascript" src="static/js/vue-router.27baea56fa1d6f323c7b.js"></script>
<script type="text/javascript" src="static/js/vuex.27baea56fa1d6f323c7b.js"></script>
我会尝试解决方案,但webpack对我来说仍然是一个谜。感谢。