{"size": 2360, "ext": "js", "max_stars_repo_path": "vue.config.js", "max_stars_repo_name": "Fearless-Studio/vue3.0-template", "max_stars_repo_stars_event_min_datetime": "2019-03-06T06:39:35.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-24T07:52:07.000Z", "max_issues_repo_path": "vue.config.js", "max_issues_repo_name": "Fearless-Studio/vue3.0-template", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "vue.config.js", "max_forks_repo_name": "Fearless-Studio/vue3.0-template", "max_forks_repo_forks_event_min_datetime": "2019-03-07T03:27:04.000Z", "max_forks_repo_forks_event_max_datetime": "2019-04-10T03:41:02.000Z"}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": 3, "avg_line_length": 23.137254902, "max_line_length": 72, "alphanum_fraction": 0.5419491525}
/* eslint-disable no-param-reassign */
const path = require('path');
const cpus = require('os').cpus().length;

module.exports = {
  // 基本路径
  publicPath: process.env.NODE_ENV === 'production'
    ? '/' // your_production_url
    : '/',

  // 输出文件目录
  outputDir: 'dist',
  assetsDir: 'static', // 静态资源目录

  // eslint-loader 是否在保存的时候检查
  lintOnSave: true,

  // webpack配置
  // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  chainWebpack: (config) => {
    config.module
      .rule('svg')
      .exclude.add(path.resolve(__dirname, './src/icons'))
      .end();

    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(path.resolve(__dirname, './src/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]',
      });
  },
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      // 为生产环境修改配置...
      config.mode = 'production';
    } else {
      // 为开发环境修改配置...
      config.mode = 'development';
    }
    Object.assign(config, {
      // 开发生产共同配置
      resolve: {
        alias: {
          '@': path.resolve(__dirname, './src'),
          '@c': path.resolve(__dirname, './src/components'),
        },
      },
    });
  },

  productionSourceMap: false, // 生产环境是否生成 sourceMap 文件

  // css相关配置
  css: {
    // 是否使用css分离插件 ExtractTextPlugin
    extract: false, // false 为开启css热更新 true为关闭 打包时置为true即可
    sourceMap: false, // 开启 CSS source maps?
    // css预设器配置项
    loaderOptions: {
      //  全局css样式，具体用法参考App.vue
      sass: {
        data: `
          @import "@/styles/index.scss";
        `,
      },
    },
    modules: false, // 启用 CSS modules for all css / pre-processor files.
  },

  parallel: cpus > 1, // 构建时开启多进程处理 babel 编译

  runtimeCompiler: true,
  // webpack-dev-server 相关配置
  devServer: {
    open: true, // 配置自动启动浏览器
    port: 8080,
    https: false,
    hotOnly: false,
    // proxy: {
    //  // 设置代理
    //  // proxy all requests starting with /api to jsonplaceholder
    //  'http://localhost:8080/': {
    //      target: 'http://baidu.com:8080', //真实请求的目标地址
    //      changeOrigin: true,
    //      pathRewrite: {
    //          '^http://localhost:8080/': ''
    //      }
    //  }
    // },
    before: (app) => {},
  },
  // 第三方插件配置
  pluginOptions: {
    // ...
  },
};
