javascript - How does webpack dllPlugin package vendor into html?
三叔
三叔 2017-07-05 10:52:50
0
2
1156

Usinghtml-webpack-plugincan only write the application'sbundle.jsto html, but not the vendor generated by the dll. Is there any way?

三叔
三叔

reply all (2)
扔个三星炸死你

You can use add-asset-html-webpack-plugin to add the packaged files to html.
Quote in the following way, or refer to my vue-2.0template

If you like it, you can give it a 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 }])
    女神的闺蜜爱上我

    Questions and answers:
    1. Generatevendor.jsto/dll/,
    2. template.html uses the template syntax of html-webpack-plugin

      

    3. Set webpack.dev.config.js

    //... plugins:[ new HTMLPlugin({ template: './src/template.html', filename: 'index.html' vendor: '/dll/' + manifest.name + '.js/' //manifest就是dll生成的json }) ]

    Only for development environment

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!