text: const webpack = require('webpack');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const ExtractTextPlugin = require('extract-text-webpack-plugin');
  const CopyWebpackPlugin = require('copy-webpack-plugin');
  const devServer = require("webpack-dev-server");
  const merge = require('webpack-merge');
  const webpackBaseConfig = require('./webpack.base.config.js');
  const fs = require('fs');
  
  fs.open('./env.js', 'w', function(err, fd) {
      const buf = 'export default "development";';
      fs.write(fd, buf, 0, buf.length, 0, function(err, written, buffer) {});
  });
  
  module.exports = merge(webpackBaseConfig, {
      devtool: '#source-map',
      output: {
          publicPath: '/dist/',
          filename: '[name].js',
          chunkFilename: '[name].chunk.js'
      },
      plugins: [
          new ExtractTextPlugin({
              filename: '[name].css',
              allChunks: true
          }),
          new webpack.optimize.CommonsChunkPlugin({
              name: ['vender-exten', 'vender-base'],
              minChunks: Infinity
          }),
          new HtmlWebpackPlugin({
              title: 'madian manage admin',
              filename: '../index.html',
              template: './src/template/index.ejs',
              inject: false
          })
      ],
      devServer: {
          historyApiFallback: true,
          contentBase: "./",
          quiet: false, //控制台中不输出打包的信息
          noInfo: false,
          hot: true, //开启热点
          inline: true, //开启页面自动刷新
          lazy: false, //不启动懒加载
          progress: true, //显示打包的进度
          watchOptions: {
              aggregateTimeout: 300
          },
          port: '8888', //设置端口号
          //其实很简单的，只要配置这个参数就可以了
          proxy: {
              '/web': {
                  target: 'http://web-madian-dev.mamaqunaer.com/',
                  pathRewrite: {
                      '^/web' : ''
                  },
                  changeOrigin: true
              },
              '/api': {
                  target: 'http://api-madian-dev.mamaqunaer.com/',
                  pathRewrite: {
                      '^/api' : ''
                  },
                  changeOrigin: true
              }
          }
  
      } 
  });