webpack.conf.js 734 B

123456789101112131415161718192021222324252627
  1. const path = require('path')
  2. const cleanWebpackPlugin = require('clean-webpack-plugin')
  3. const copyWebpackPlugin = require('copy-webpack-plugin')
  4. const htmlWebpackPlugin = require('html-webpack-plugin')
  5. module.exports = {
  6. entry: {
  7. env: './config/env.js'
  8. },
  9. output: {
  10. path: path.resolve(__dirname, 'dist'),
  11. filename: 'js/[name].js'
  12. },
  13. plugins: [
  14. new cleanWebpackPlugin(["dist"]),
  15. new htmlWebpackPlugin({
  16. filename: 'index.html',
  17. template: './src/index.html',
  18. inject: 'head'
  19. }),
  20. new copyWebpackPlugin([{
  21. from: path.resolve(__dirname, 'src'),
  22. to: path.resolve(__dirname, 'dist'),
  23. ignore: ["index.html", "js/env.js"]
  24. }])
  25. ]
  26. }