I'm working with react-app-rewired, and when I try to initialize the project using react-app-rewired start, I tried to build and I received the same error, that is my config-overrides.js:

const { override, addWebpackAlias, addBabelPlugin } = require('customize-cra')
const rewireSvgReactLoader = require('react-app-rewire-svg-react-loader')
const path = require('path')

function myOverrides(config, env) {
  config = rewireSvgReactLoader(config, env)
  return config
}
module.exports = override(
  myOverrides,
  addWebpackAlias({
    mockApi: path.resolve(__dirname, 'src/legacy-lib/mockAPI'),
    Pages: path.resolve(__dirname, 'src/pages'),
    ['@Redux']: path.resolve(__dirname, 'src/redux/store'),
    ['~']: path.resolve(__dirname, 'src'),
    Assets: path.resolve(__dirname, 'src/assets'),
    Components: path.resolve(__dirname, 'src/components'),
    Layout: path.resolve(__dirname, 'src/components/layout'),
    Common: path.resolve(__dirname, 'src/components/common'),
    Form: path.resolve(__dirname, 'src/components/legacy-form'),
    Middleware: path.resolve(__dirname, 'src/legacy-lib/middleware'),
    Actions: path.resolve(__dirname, 'src/legacy-redux/actions'),
    Reducers: path.resolve(__dirname, 'src/legacy-redux/reducers'),
    Routes: path.resolve(__dirname, 'src/routing'),
    Const: path.resolve(__dirname, 'src/legacy-lib/const'),
    Modules: path.resolve(__dirname, 'src/modules'),
    ['@condofy/next']: path.resolve(__dirname, 'src/next')
  }),
  addBabelPlugin('babel-plugin-styled-components')
)

and the error message:

$ yarn start
yarn run v1.22.19
$ react-app-rewired start
Failed to compile.

Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.module.rules[1].oneOf[2].use[1] has an unknown property 'test'. These properties are valid:
   object { ident?, loader?, options? }

error Command failed with exit code 1.

How can I fix it?

0

There are 0 answers