craco-antd and react-scripts 5.0.0
See original GitHub issueNot compatible with react-scripts 5.0.0 😥 https://www.npmjs.com/package/react-scripts/v/5.0.0
yarn start
output
(node:81909) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'push' of undefined
at Object.overrideWebpackConfig (app/node_modules/craco-less/lib/craco-less.js:141:34)
at Object.overrideWebpackConfig (app/node_modules/craco-antd/lib/craco-antd.js:64:26)
at overrideWebpack (app/node_modules/@craco/craco/lib/features/plugins.js:42:40)
at app/node_modules/@craco/craco/lib/features/plugins.js:64:29
at Array.forEach (<anonymous>)
at applyWebpackConfigPlugins (app/node_modules/@craco/craco/lib/features/plugins.js:63:29)
at mergeWebpackConfig (app/node_modules/@craco/craco/lib/features/webpack/merge-webpack-config.js:110:30)
at overrideWebpackDev (app/node_modules/@craco/craco/lib/features/webpack/override.js:11:36)
at app/node_modules/@craco/craco/scripts/start.js:27:5
(Use `node --trace-warnings ...` to show where the warning was created)
(node:81909) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise
which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
`--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:81909) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections
that are not handled will terminate the Node.js process with a non-zero exit code.
my package.json
"devDependencies": {
"@craco/craco": "^6.4.3",
"craco-alias": "^3.0.1",
"craco-antd": "^1.19.0",
"craco-sass-resources-loader": "^1.1.0",
"typescript": "^4.5.2"
}
my craco.config.js
(only 3 plugins)
// * Craco docs
// * https://github.com/gsoft-inc/craco/blob/master/packages/craco/README.md
// * Plugins
const CracoAntDesignPlugin = require('craco-antd');
const sassResourcesLoader = require('craco-sass-resources-loader');
const CracoAlias = require('craco-alias');
const path = require('path');
const pathResolve = (pathUrl) => path.join(__dirname, pathUrl);
module.exports = {
reactScriptsVersion: 'react-scripts',
// Don't reorder plugins
plugins: [
{
// https://www.npmjs.com/package/craco-antd
plugin: CracoAntDesignPlugin,
options: {
customizeThemeLessPath: pathResolve('./src/styles/antd/theme.less'),
},
},
{
// https://www.npmjs.com/package/craco-sass-resources-loader
plugin: sassResourcesLoader,
options: {
resources: './src/styles/core.scss',
},
},
{
// https://www.npmjs.com/package/craco-alias
plugin: CracoAlias,
options: {
source: 'tsconfig',
// baseUrl SHOULD be specified
// plugin does not take it from tsconfig
baseUrl: './',
// tsConfigPath should point to the file where "baseUrl" and "paths" are specified
tsConfigPath: './tsconfig.extend.json',
},
},
],
};
I commented CracoAntDesignPlugin
& tried re-run yarn start
and my app was built/ran correctly.
My temporary fix:
returned to version "react-scripts": "4.0.3"
I will wait for updates. Thanks
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
Craco does not work properly with react-scripts@5.0.0
After upgrading react-scripts to v5, craco start does not work properly. App starts with no error but in browser, there is a blank...
Read more >craco-less 2.0.0 requires react-scripts 5 but that's incompatible ...
I can't seem to find versions of react-scripts and craco that are compatible with both craco-less 2.0.0 and each other. craco 6.4.3 requires ......
Read more >Use in create-react-app - Ant Design
We can achieve that by using craco which is one of create-react-app's custom config solutions. Install craco and modify the scripts field in...
Read more >You need to update your react-script package. As craco@6.4 ...
Portable Document Format (PDF) - developed 30 years ago still exists and is one of the most...
Read more >craco-less examples - CodeSandbox
Learn how to use craco-less by viewing and forking craco-less example apps on CodeSandbox. ... ant-design/create-react-app-antd.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
rel https://github.com/DocSpring/craco-less/issues/86
Should be working now. Let’s open a new issue ticket if there are still issues.