webpack.dev.conf.js 701 B

12345678910111213141516171819202122232425262728293031
  1. var path = require('path');
  2. var merge = require('webpack-merge');
  3. var baseConfig = require('./webpack.base.conf');
  4. var webpack = require('webpack');
  5. module.exports = merge(baseConfig, {
  6. mode: 'development',
  7. devServer: {
  8. contentBase: path.join(__dirname, 'dist'),
  9. open: true,
  10. compress: true,
  11. port: 8888
  12. },
  13. module:{
  14. rules: [
  15. {
  16. test: /\.(c|le)ss$/,
  17. use: [
  18. 'style-loader',
  19. 'css-loader',
  20. 'less-loader'
  21. ]
  22. }
  23. ]
  24. },
  25. plugins: [
  26. new webpack.HotModuleReplacementPlugin(), // 开启热更新
  27. new webpack.DefinePlugin({
  28. 'process.env': require('../config/dev.env')
  29. }), // 配置请求地址
  30. ]
  31. })