CRA + craco构建中的SyntaxError

时间:2020-09-21 15:10:57

标签: webpack create-react-app craco

这是我的craco.config.js

const CracoLessPlugin = require('craco-less');
const CracoAlias = require('craco-alias');

module.exports = {
  babel: {
    plugins: [
      ["@babel/plugin-proposal-decorators", { legacy: true }],
      ["import", { "libraryName": "antd", "style": true }],
    ]
  },
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: { '@primary-color': '#1DA57A' },
            javascriptEnabled: true,
          },
        },
      }
    },
    {
      plugin: CracoAlias,
      options: {
        source: 'tsconfig',
        tsConfigPath: './tsconfig.extend.json',
        baseUrl: './src',
      }
    }
  ],
};

运行构建后,出现错误。 enter image description here

我想我需要在craco.config.js中进行一些webpack配置,但是我不知道该怎么做。 目前,我对webpack的了解很少。因此,为您提供直接解决方案将是非常高兴的。谢谢

0 个答案:

没有答案