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

Update Craco less to fix production build problem #28

Closed
wants to merge 2 commits into from

Conversation

pybuche
Copy link
Contributor

@pybuche pybuche commented Apr 30, 2020

Hi !

It looks like there is a problem with the craco-less dependency. I updated the version to the latest one, I guess this would help solve my problem.

Below the error log I encountered. Looks like it happens a few other times after reading the issues.
Hope this PR will solve it 🤞 Thanks !

/app/node_modules/@craco/craco/lib/plugin-utils.js:29
    throw new Error(
    ^

Error: Found an unhandled loader in the production webpack config: /app/node_modules/style-loader/index.js

This error probably occurred because you updated react-scripts or craco. Please try updating craco-less to the latest version:

   $ yarn upgrade craco-less

Or:

   $ npm update craco-less

If that doesn't work, craco-less needs to be fixed to support the latest version.
Please check to see if there's already an issue in the FormAPI/craco-less repo:

   * https://github.com/FormAPI/craco-less/issues?q=is%3Aissue+webpack+unknown+rule

If not, please open an issue and we'll take a look. (Or you can send a PR!)

You might also want to look for related issues in the craco and create-react-app repos:

   * https://github.com/sharegate/craco/issues?q=is%3Aissue+webpack+unknown+rule
   * https://github.com/facebook/create-react-app/issues?q=is%3Aissue+webpack+unknown+rule

    at throwUnexpectedConfigError (/app/node_modules/@craco/craco/lib/plugin-utils.js:29:11)
    at throwError (/app/node_modules/craco-less/lib/craco-less.js:14:5)
    at /app/node_modules/craco-less/lib/craco-less.js:119:7
    at Array.forEach (<anonymous>)
    at Object.overrideWebpackConfig (/app/node_modules/craco-less/lib/craco-less.js:51:11)
    at Object.overrideWebpackConfig (/app/node_modules/craco-antd/lib/craco-antd.js:63: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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! staycation-admin@1.0.0 start: `craco start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the staycation-admin@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /app/.npm/_logs/2020-04-30T08_11_08_192Z-debug.log

@pybuche
Copy link
Contributor Author

pybuche commented Apr 30, 2020

Hi,

I pushed a deep further my investigation and it looks like it fixes the problem ! I'm not exactly sure where the problem lies, but it seems that either craco-less or react-scripts new versions uses an additionnal loader in the webpack config, thus the error.

Updating them seems to be OK.
Could anyone else test it to validate this fix?

Thx!

@pybuche
Copy link
Contributor Author

pybuche commented Apr 30, 2020

Weird behavior of the yarn audit command 🤔

@ndbroadbent
Copy link
Member

Hello, thanks a lot for the PR! It looks like yarn audit is showing some security vulnerabilities. I was wondering if I could please ask for your help with updating some of these packages? (If it can't be fixed with an update, then it might also be ok to comment out the yarn audit line temporarily.)

@ndbroadbent
Copy link
Member

Hello, thanks very much! I've rebased and merged in your changes

@ndbroadbent
Copy link
Member

Changes have been pushed to craco-antd version 1.15.0

@pybuche
Copy link
Contributor Author

pybuche commented Jun 1, 2020

Hi! Sorry I took a few days to answer.
Good news, thanks for the update! In the meantime, I had to improvise and do it by myself to make the antd overrides work.
I'll update craco-antd as soon as I can.

If you need anything else, please tell me

@pybuche pybuche deleted the update-craco-less branch June 1, 2020 08:41
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 this pull request may close these issues.

None yet

2 participants