-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
My NODE_ENV is set to custom. I'm trying to set up ant design in a CRA project. I'm following the guide here, https://ant.design/docs/react/use-with-create-react-app. I created a craco.config.js file like the following,
const CracoLessPlugin = require('craco-less');
module.exports = {
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {
'@primary-color': '#1DA57A'
},
javascriptEnabled: true,
},
},
},
},
],
};
But upon npm start (craco start), I am greeted with the following error,
(node:16620) UnhandledPromiseRejectionWarning: Error: Found an unhandled loader in the custom webpack config: E:\project\node_modules\style-loader\dist\cjs.js
I looked at the source and it seems to be checking the environment variable,
if (
(context.env === "development" || context.env === "test") &&
rule.loader.includes(`${pathSep}style-loader${pathSep}`)
) {
lessRule.use.push({
loader: rule.loader,
options: {
...rule.options,
...(pluginOptions.styleLoaderOptions || {}),
},
});
}
After I set my NODE_ENV to development this error is gone.
I am not exactly sure what caused the issue. So my question is does craco-less not support setting a custom value to NODE_ENV?
yilianhuaixiao and captain-c
Metadata
Metadata
Assignees
Labels
No labels