text: 'use strict'
  const path = require('path')
  
  function resolve(dir) {
    return path.join(__dirname, dir)
  }
  
  // All configuration item explanations can be find in https://cli.vuejs.org/config/
  module.exports = {
    /**
     * You will need to set publicPath if you plan to deploy your site under a sub path,
     * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
     * then publicPath should be set to "/bar/".
     * In most cases please use '/' !!!
     * Detail: https://cli.vuejs.org/config/#publicpath
     */
    publicPath: '/',
    outputDir: 'dist',
    assetsDir: 'static',
    lintOnSave: process.env.NODE_ENV === 'development',
    productionSourceMap: false,
    configureWebpack: {
      // provide the app's title in webpack's name field, so that
      // it can be accessed in index.html to inject the correct title.
      name: 'peach-cropper-demo',
      resolve: {
        alias: {
          '@': resolve('src')
        }
      }
    },
    chainWebpack(config) {
      // vue-loader 是处理 *.vue 文件的 webpack loader。它本身提供了丰富的 API，有些 API 很实用但很少被人熟知。
      // preserveWhitespace，它的作用是阻止元素间生成空白内容，能减少代码体积
      config.module
        .rule('vue')
        .use('vue-loader')
        .loader('vue-loader')
        .tap((options) => {
          options.compilerOptions.preserveWhitespace = true
          return options
        })
        .end()
    }
  }