美文网首页
6.htmlwebpackPlugin

6.htmlwebpackPlugin

作者: 风雪之隅_b6f7 | 来源:发表于2019-03-26 11:17 被阅读0次

plugin:类似生命周期函数

1.npm install--save-dev html-webpack-plugin

const HtmlWebpackPlugin=require('html-webpack-plugin');

const path=require('path');

module.exports={

entry:'index.js',

output:{

       path:path.resolve(__dirname,'./dist'),

     filename:'index_bundle.js'

    },

plugins: [ 

             new HtmlWebpackPlugin(

                   { template:'./src/index.html'}

                )

           ]

};

2.打包后自动生成dist/index.html,并把打包生成的js文件自动引入到index.html页面上

相关文章

  • 6.htmlwebpackPlugin

    plugin:类似生命周期函数 1.npm install--save-dev html-webpack-plug...

网友评论

      本文标题:6.htmlwebpackPlugin

      本文链接:https://www.haomeiwen.com/subject/ypowvqtx.html