84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
Verwenden Sie html-webpack-plugin只能将应用的bundle.js, um in HTML zu schreiben, aber der von der DLL generierte Anbieter kann nicht geschrieben werden.
html-webpack-plugin
bundle.js
可以使用 add-asset-html-webpack-plugin,将打包后的文件,加入html中。通过以下方式引用,或者参考下我的vue-2.0template
喜欢的话可以给个star
new HtmlWebpackPlugin({ filename: itemPath, template: template, inject: true, title: item.title || 'Document', chunks: chunks, chunksSortMode: 'dependency', }), new AddAssetHtmlPlugin([{ filepath: path.resolve(__dirname, config.build.dll.basePath, config.build.dll.fileName), outputPath: utils.assetsPath('common/js/'), publicPath: path.join(config.build.publicPath, 'common/js'), includeSourcemap: true }])
自问自答:1、 将vendor.js生成到/dll/,2、 template.html使用html-webpack-plugin的模板语法
vendor.js
/dll/
<body> <script src="<%= htmlWebpackPlugin.optiions.vendor %>"></script> </body>
3、 设置webpack.dev.config.js
//... plugins:[ new HTMLPlugin({ template: './src/template.html', filename: 'index.html' vendor: '/dll/' + manifest.name + '.js/' //manifest就是dll生成的json }) ]
仅仅用于开发环境
可以使用 add-asset-html-webpack-plugin,将打包后的文件,加入html中。
通过以下方式引用,或者参考下我的vue-2.0template
喜欢的话可以给个star
自问自答:
1、 将
vendor.js
生成到/dll/
,2、 template.html使用html-webpack-plugin的模板语法
3、 设置webpack.dev.config.js
仅仅用于开发环境