1、一般vue打包之后都是生成了一个dist文件夹 里面有一个static文件夹和一个index.html文件
2、在这个index.html里引入了几个webpack生成的js文件 什么vendor manifest之类的
3、但是我这个打包不知道是不是有问题 我在indeex.html看到通过script引入了这几个JS文件 但是我在static/js 里没有找到vendor.js和main.js啊 其它的JS倒是有 我估计之前我的项目一直报webpackJsonp is not defined这个错误就跟这里的文件引用有关系
4、并且从我的webpack.prod.conf.js里的配置看应该也会在dist/static/js下生成一个app.xxxxxxxx.js这样的js文件才对 但是我的没有生成这个文件
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunks: ['manifest', 'vendor', 'app'],
chunksSortMode: 'dependency'
}),
// keep module.id stable when vender modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function (module) {
// 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',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
唉 困扰很久的问题了
webpack的配置文件里output怎么配置的