webpack.dev.conf.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. host: '192.168.1.226'
  46. },
  47. plugins: [
  48. new webpack.HotModuleReplacementPlugin(), // 开启热更新
  49. new webpack.DefinePlugin({
  50. 'process.env': require('../config/dev.env')
  51. }), // 配置请求地址
  52. ]
  53. })