webpack.dev.js 767 B

123456789101112131415161718192021222324252627282930313233
  1. const webpack = require('webpack')
  2. const merge = require('webpack-merge')
  3. const commonConf = require('./webpack.common.js')
  4. const HTMLWebpackPlugin = require('html-webpack-plugin')
  5. const path = require('path')
  6. const devConf = {
  7. entry: {
  8. index: path.resolve(__dirname, 'demo/index.js')
  9. },
  10. mode: 'development',
  11. devtool: 'cheap-module-eval-source-map',
  12. output: {
  13. filename: 'index.js',
  14. path: path.resolve(__dirname, 'dist'),
  15. },
  16. devServer: {
  17. contentBase: 'dist',
  18. open: true,
  19. hot: true,
  20. overlay: true,
  21. proxy: {
  22. }
  23. },
  24. plugins: [
  25. new webpack.HotModuleReplacementPlugin(),
  26. new HTMLWebpackPlugin({
  27. template: path.resolve(__dirname, 'demo/index.html')
  28. })
  29. ]
  30. }
  31. module.exports = merge(commonConf, devConf)