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 merge = require('webpack-merge');
  const webpackBaseConfig = require('./webpack.base.config.js');
  const fs = require('fs');
  const package = require('../package.json');
  
  fs.open('./build/env.js', 'w', function(err, fd) {
      // const buf = 'export default "development";';
  
      // fix error in node 10
      const buf = Buffer.from('export default "development";');
      fs.write(fd, buf, 0, buf.length, 0, function(err, written, buffer) {});
  });
  
  module.exports = merge(webpackBaseConfig, {
      devtool: '#source-map',
      output: {
          // publicPath: '/static/',
          filename: '[name].js',
          chunkFilename: '[name].chunk.js'
          // filename: '[name].[hash].js',
          // chunkFilename: '[name].[hash].chunk.js'
      },
      plugins: [
          new ExtractTextPlugin({
              filename: '[name].css',
              // filename: '[name].[hash].css',
              allChunks: true
          }),
          new webpack.optimize.CommonsChunkPlugin({
              name: ['vender-exten', 'vender-base'],
              minChunks: Infinity
          }),
          new HtmlWebpackPlugin({
              title: 'iView admin v' + package.version,
              template: './index.html',
              inject: true
          }),
          new CopyWebpackPlugin([
              {
                  from: 'src/views/main-components/theme-switch/theme'
              },
              {
                  from: 'src/views/my-components/text-editor/tinymce'
              }
          ], {
              ignore: [
                  'text-editor.vue'
              ]
          })
      ]
  });