webpack.dev.conf.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // 存放dev配置
  2. const merge = require('webpack-merge');
  3. const webpack = require('webpack');
  4. const baseConfig = require('./webpack.base.conf');
  5. const path = require('path');
  6. module.exports = merge(baseConfig, {
  7. devtool: 'inline-source-map',
  8. module: {
  9. rules: [
  10. {
  11. test: /\.(sa|sc|c)ss$/,
  12. use: [
  13. {
  14. loader: 'vue-style-loader',
  15. options: {
  16. publicPath: '../'
  17. }
  18. },
  19. 'css-loader',
  20. 'postcss-loader',
  21. 'sass-loader',
  22. ],
  23. },
  24. {
  25. test: /\.less$/,
  26. use: [
  27. {
  28. loader: 'vue-style-loader',
  29. options: {
  30. publicPath: '../'
  31. }
  32. },
  33. 'css-loader',
  34. 'postcss-loader',
  35. 'less-loader',
  36. ],
  37. },
  38. ]
  39. },
  40. devServer: {
  41. contentBase: path.resolve(__dirname, '../dist'), //告诉服务其从哪提供内容
  42. hot: true,
  43. open: true
  44. },
  45. plugins: [
  46. new webpack.HotModuleReplacementPlugin(), // 开启热更新
  47. new webpack.DefinePlugin({
  48. 'process.env': require('../config/dev.env')
  49. }), // 配置请求地址
  50. ]
  51. })