webpack.dev.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const webpack = require('webpack')
  2. const merge = require('webpack-merge')
  3. const commonConf = require('./webpack.common.js')
  4. const devConf = {
  5. mode: 'development',
  6. devtool: 'cheap-module-eval-source-map',
  7. devServer: {
  8. contentBase: 'dist',
  9. open: true,
  10. hot: true,
  11. overlay: true,
  12. proxy: {
  13. }
  14. },
  15. module: {
  16. rules: [
  17. {
  18. test: /(?<!\.module)\.(scss|css)$/,
  19. use: [
  20. 'style-loader',
  21. {
  22. loader: 'css-loader',
  23. options: {
  24. importLoaders: 2
  25. }
  26. },
  27. 'sass-loader',
  28. 'postcss-loader'
  29. ]
  30. },
  31. {
  32. test: /(?<=\.module)\.(scss|css)$/,
  33. use: [
  34. 'style-loader',
  35. {
  36. loader: 'css-loader',
  37. options: {
  38. importLoaders: 2,
  39. modules: true
  40. }
  41. },
  42. 'sass-loader',
  43. 'postcss-loader'
  44. ]
  45. }
  46. ]
  47. },
  48. plugins: [
  49. new webpack.HotModuleReplacementPlugin()
  50. ]
  51. }
  52. module.exports = merge(commonConf, devConf)