const CracoLessPlugin = require('craco-less');
const { name } = require('./package');
const path = require('path');

module.exports = {
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: {
              '@ant-prefix': 'yy',
              // '@border-color-split': 'hsv(0, 0, 85%)',
              '@border-radius-base': '4px',
              '@primary-color': '#196AD2',
              '@success-color': '#8FC31F',
              '@warning-color': '#F7AB00',
              '@error-color': '#E94848',
             },
            javascriptEnabled: true,
          },
        },
      },
    },
  ],
  webpack: {
    alias: {
      "@": path.resolve("src"),
    },
    configure: {
      output: {
        library: `${name}-[name]`,
        libraryTarget: 'umd',
        chunkLoadingGlobal: `webpackJsonp_${name}`,
        globalObject: 'window',
      },
      module: {
        rules: [
          {
            test: /\.m?js/,
            resolve: {
              fullySpecified: false,
            },
          },
        ],
      },
    }
  },
  devServer: {
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    proxy: {
      '/api': {
          target: 'http://192.168.0.179:8089',
          changeOrigin: true,
      },
      '/data-quality-szse': {
          target: 'http://192.168.0.38:8089',
          changeOrigin: true,
      },
    },
    // historyApiFallback: true,
    // hot: false,
    // watchContentBase: false,
    // liveReload: false,
  },
};