webpack.dev.conf.js 1.2 KB

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