DocSpring / craco-less

A Less plugin for craco / react-scripts / create-react-app
MIT License
123 stars 48 forks source link

Found an unhandled loader in the developement webpack config: .../node_modules/style-loader/index.js #51

Closed cosydney closed 3 years ago

cosydney commented 4 years ago

Hey,

I get a upgrade craco-less error but even though I updgrade it doesn't change anything. It is weird because it was working yesterday and I have not made any major changes since yesterday it just started throwing this error.

I'm using latest version of craco and craco-less:

"@craco/craco": "^5.7.0",
"craco-less": "^1.17.0",

Thanks

(node:11523) UnhandledPromiseRejectionWarning: Error: Found an unhandled loader in the developement webpack config: 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 (.../node_modules/@craco/craco/lib/plugin-utils.js:29:11)
    at throwError (.../node_modules/craco-less/lib/craco-less.js:14:5)
    at .../node_modules/craco-less/lib/craco-less.js:119:7
    at Array.forEach (<anonymous>)
    at Object.overrideWebpackConfig (.../node_modules/craco-less/lib/craco-less.js:51:11)
    at overrideWebpack (.../node_modules/@craco/craco/lib/features/plugins.js:42:40)
    at .../node_modules/@craco/craco/lib/features/plugins.js:64:29
    at Array.forEach (<anonymous>)
    at applyWebpackConfigPlugins (.../node_modules/@craco/craco/lib/features/plugins.js:63:29)
    at mergeWebpackConfig (.../node_modules/@craco/craco/lib/features/webpack/merge-webpack-config.js:67:30)
(node:11523) 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:11523) [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.
cosydney commented 4 years ago

Related issue on this thread: #30 CRA 3.3.0 - webpack unknown rule

sadsa commented 4 years ago

@cosydney - I also experienced a similar issue today. Can you confirm what your NodeJS NODE_ENV variable is? When I set mine to production, I saw this error, but when I set it back to development, the issue disappeared.

You should be able to see this by typing node in the command prompt which will open the node shell and then type process.env.NODE_ENV.

cosydney commented 4 years ago

@sadsa Thank you it's exactly what happened, I changed my NODE_ENV variable and this cause that issue !

AsmaDhanePersonal commented 3 years ago

Any update to this issue please?

russelldc commented 3 years ago

On the latest version of react-scripts, craco and craco-less, it seems like production builds are silently failing to compile less files.

Running with craco start will add our index.less to the app, but craco build does not.

Running craco start with NODE_ENV set to production highlights what I think might be the real issue?

The same exact behavior is also happening when I tried downgrading to: react-scripts@^3.2.0: 3.4.4 @craco/craco@^5.5.0: 5.9.0

Aashir1 commented 9 months ago

Thanks, @sadsa! I've been struggling since yesterday, but just by setting NODE_ENV=development, I managed to sort out this issue.