const fs = require('fs');
// const copywebpackplugin = require('copy-webpack-plugin');
// const { name } = require("./package.json");
const name = 'dist';
// publicPath = process.env.NODE_ENV === "development" ? "/" : `/${name}`;
publicPath = '/';
module.exports = {
  publicPath: publicPath, //相对路径
  outputDir: name, //打包名称
  // assetsDir: `${pagesInfo.outputDir}/assets`,
  productionSourceMap: false,
  lintOnSave: false, //关闭lint代码
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
  },
  devServer: {
    historyApiFallback: {
      // rewrites: pagesInfo.devServerPath,
    },
    port: 9906,
    proxy: {
      "/duoduo-service": {
          target: "http://api.sagacloud.cn",
          changeOrigin: true,
          secure: false,
      }
    }
  },
  chainWebpack: (config) => {
    // config
    //   .plugin('copy')
    //   .use(copywebpackplugin, [
    //     [{
    //       from: 'src/public',
    //       to: 'public',
    //       toType: 'dir',
    //     }],
    //   ]);
  },
};