text: var path = require('path')
  var utils = require('./utils')
  var config = require('../config')
  var vueLoaderConfig = require('./vue-loader.conf')
  var webpack = require('webpack')
  var projectConfig = require('../src/config')
  
  
  function resolve(dir) {
    return path.join(__dirname, '..', dir)
  }
  
  var DEV_HOST = projectConfig.devHost + projectConfig.apiPrefix;
  var PUB_HOST = projectConfig.pubHost + projectConfig.apiPrefix;
  
  module.exports = {
    entry: {
      app: './src/main.js'
    },
    output: {
      path: config.build.assetsRoot,
      filename: '[name].js',
      publicPath: process.env.NODE_ENV === 'production'
        ? config.build.assetsPublicPath
        : config.dev.assetsPublicPath
    },
    resolve: {
      extensions: ['.js', '.vue', '.json', '.less'],
      alias: {
        'vue$': 'vue/dist/vue.esm.js',
        '@': resolve('src'),
        'src': path.resolve(__dirname, '../src'),
        'assets': path.resolve(__dirname, '../src/assets'),
        'components': path.resolve(__dirname, '../src/components'),
        'pages': path.resolve(__dirname, '../src/pages'),
        'styles': path.resolve(__dirname, '../src/styles'),
        'utils': path.resolve(__dirname, '../src/utils'),
      }
    },
    plugins: [
      new webpack.DefinePlugin({
        HOST: "'" + (process.env.NODE_ENV === 'production' ? PUB_HOST : DEV_HOST) + "'"
      }),
  
    ],
    module: {
      rules: [
        {
          test: /\.vue$/,
          use: [
            {
              loader: 'vue-loader',
              options: vueLoaderConfig
            },
            {
              loader: 'iview-loader',
              options: {
                prefix: false
              }
            }
          ]
        },
        {
          test: /\.js$/,
          loader: 'babel-loader',
          include: [resolve('src'),
            resolve('test'), resolve('/node_modules/iview/src'), resolve('/node_modules/iview/packages'),
            resolve('/node_modules/quill-image-extend-module/')]
        },
        {
          test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
          loader: 'url-loader',
          options: {
            limit: 10000,
            name: utils.assetsPath('img/[name].[hash:7].[ext]')
          }
        },
        {
          test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
          loader: 'url-loader',
          options: {
            limit: 10000,
            name: utils.assetsPath('media/[name].[hash:7].[ext]')
          }
        },
        {
          test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
          loader: 'url-loader',
          options: {
            limit: 800000,
            name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
          }
        },
        {
          test: /iview\/.*?js$/,
          loader: 'babel-loader'
        },
        {
          test: /\.js$/,
          loader: 'babel-loader',
          exclude: /node_modules/
        },
      ]
    }
  }
  