Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 纱线开始不&x27;无法使用重新布线的应用程序_Reactjs_Npm_Yarnpkg_Antd - Fatal编程技术网

Reactjs 纱线开始不&x27;无法使用重新布线的应用程序

Reactjs 纱线开始不&x27;无法使用重新布线的应用程序,reactjs,npm,yarnpkg,antd,Reactjs,Npm,Yarnpkg,Antd,当我运行纱线启动时,我得到以下输出 $ yarn start yarn run v1.15.2 $ react-app-rewired start The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customize-cra plugins in replacement - https://github.com/arackaf/customize-cra#available-plugins err

当我运行纱线启动时,我得到以下输出

$ yarn start
yarn run v1.15.2
$ react-app-rewired start
The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customize-cra plugins in replacement - https://github.com/arackaf/customize-cra#available-plugins
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
我试着在:上阅读文档,但因为我是React和npm新手,所以对我来说没有多大意义,我也不知道用哪个插件替换不推荐的助手

我的
config overrides.js
看起来像:

const { injectBabelPlugin } = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');

module.exports = function override(config, env) {
   config = injectBabelPlugin(['import', { libraryName: 'antd', style: true }], config);  // change importing css to less
   config = rewireLess.withLoaderOptions({
       modifyVars: {
           "@primary-color": "#1DA57A"
       },
   })(config, env);
    return config;
};

不要使用
injectBabelPlugin
此Pugin已弃用

像这样使用

const {
  override,
  fixBabelImports,
  addLessLoader,
} = require("customize-cra");


module.exports = override(
  fixBabelImports("import", {
    libraryName: "antd", libraryDirectory: "es", style: true // change importing css to less
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: { "@primary-color": "#1DA57A" }
  })
);