webpack 打包html文件

1、安装webpack-html-plugin模块

$ npm install webpack-html-plugin —save-dev

2webpack.config.js文件写入

var WebpackHtmlPlugin = require(‘webpack-html-plugin');

output: {

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

    publicPath: '/dist/',

    filename: '[name].js'

  },

  plugins: [

    new WebpackHtmlPlugin({

      template:'forgetPass.html',

      filename:'forgetPass.html'

    }),

    new WebpackHtmlPlugin({

      template:’app/utils/crawTask/crawTaskProcess/websiteRange/failSheet.html’,

      filename:'utils/crawTask/crawTaskProcess/websiteRange/failSheet.html'

    })

  ]

 

码文不易,谢谢打赏

码文不易,谢谢打赏

posted @ 2017-07-26 12:07  respectable  阅读(3347)  评论(0编辑  收藏  举报