webpack.config.js 629 B

123456789101112131415161718192021
  1. const {resolve} = require('path')
  2. const HtmlWebpackPlugin = require('html-webpack-plugin')
  3. const EsLintPlugin = require('eslint-webpack-plugin')
  4. module.exports = {
  5. entry:'./src/js/index.js',
  6. output:{
  7. filename:'js/built.js',
  8. path:resolve(__dirname,'build')
  9. },
  10. plugins:[
  11. new HtmlWebpackPlugin({
  12. template:'./src/index.html'
  13. }),
  14. new EsLintPlugin({
  15. extensions: ['js', 'json', 'coffee'],
  16. //exclude: '/node_modules/', //default
  17. fix:true
  18. })
  19. ],
  20. mode:'production' //生产环境下会自动压缩
  21. }