Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

craco-antd and react-scripts 5.0.0 #73

Closed
floatrx opened this issue Dec 19, 2021 · 5 comments
Closed

craco-antd and react-scripts 5.0.0 #73

floatrx opened this issue Dec 19, 2021 · 5 comments

Comments

@floatrx
Copy link

floatrx commented Dec 19, 2021

Not 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

@maciossek
Copy link

rel DocSpring/craco-less#86

@floatrx floatrx changed the title react-scripts 5.0.0 craco-antd and react-scripts 5.0.0 Dec 21, 2021
@inconduit
Copy link

craco-less has released 2.0.0 with react-scripts 5 support https://www.npmjs.com/package/craco-less

made a quick attempt of bumping the craco-less dependency here to 2.0.0 but it caused 5 test failures

can someone with experience maintaining this lib take care of that?

@huynguyenchk
Copy link

I have the same issue with craco-antd 1.19.0 & react-scripts 5.0.0. craco-less has released 2.0 but craco-antd have no update yet

sheiy added a commit to sheiy/craco-antd that referenced this issue Jan 7, 2022
@rkhaslarov
Copy link

I have the same issue with craco-antd 1.19.0 & react-scripts 5.0.0. craco-less has released 2.0 but craco-antd have no update yet

@kamronbatman
Copy link
Collaborator

Should be working now. Let's open a new issue ticket if there are still issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants