123456789101112131415161718192021222324252627 |
- const {resolve} = require('path')
- const HtmlWebpackPlugin = require('html-webpack-plugin')
- const EsLintPlugin = require('eslint-webpack-plugin')
- module.exports = {
- entry:'./src/js/index.js',
- output:{
- filename:'js/built.js',
- path:resolve(__dirname,'build')
- },
- plugins:[
- new HtmlWebpackPlugin({
- template:'./src/index.html',
- minify:{
- //去除空格
- collapseWhitespace:true,
- //去除注释
- removeComments:true
- }
- }),
- new EsLintPlugin({
- extensions: ['js', 'json', 'coffee'],
- //exclude: '/node_modules/', //default
- fix:true
- })
- ],
- mode:'production' //生产环境下会自动压缩
- }
|