使用craco修改create-react-app的默认配置

1.安装craco:

yarn add @craco/craco or npm i @craco/craco

  1. 安装好,修改
    "scripts": {
  • "start": "react-scripts start",
  • "build": "react-scripts build",
  • "test": "react-scripts test",
  • "start": "craco start",
  • "build": "craco build",
  • "test": "craco test",
    }
  1. 安装 yarn add craco-less,新建craco.config.js 和
    添加
    const CracoLessPlugin = require('craco-less');

module.exports = {
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: { '@primary-color': '#1DA57A' },
javascriptEnabled: true,
},
},
},
},
],
};

你可能感兴趣的:(使用craco修改create-react-app的默认配置)