text: const path = require('path')
  const webpack = require('webpack')
  const webpackCommonConf = require('./webpack.common.js')
  const { merge } = require('webpack-merge')
  const { srcPath, distPath } = require('./paths')
  
  module.exports = merge(webpackCommonConf, {
    mode: 'development',
    module: {
      rules: [
        {
          test: /\.(js|jsx)$/,
          loader: ['babel-loader?cacheDirectory'],
          include: srcPath,
          exclude: /node_modules/
        },
        // 直接引入图片 url
        {
          test: /\.(png|jpg|jpeg|gif)$/,
          use: 'file-loader'
        },
        {
          test: /\.css$/,
          loader: ['style-loader', 'css-loader', 'postcss-loader']
        },
        {
          test: /\.less$/,
          loader: ['style-loader', 'css-loader', 'less-loader']
        }
      ]
    },
    plugins: [
      new webpack.DefinePlugin({
        // window.ENV = 'development'
        ENV: JSON.stringify('development')
      }),
      new webpack.NamedModulesPlugin(),
      new webpack.HotModuleReplacementPlugin()
    ],
    devServer: {
      port: 8080,
      progress: true, // 显示打包的进度
      contentBase: distPath, // 根目录
      open: true, // 自动打开浏览器
      compress: true, // 启动 gzip 压缩
      hot: true,
      // 设置代理
      proxy: {
        // 将本地 /api/xxx 代理到 localhost:3000/api/xxx
        '/api': 'http://localhost:3000',
        // 将本地 /api2/xxx 代理到 localhost:3000/xxx
        '/api2': {
          target: 'http://localhost:3000',
          pathRewrite: {
            '/api2': ''
          }
        }
      }
    }
  })