cannot use module.less in newest create-react-app
See original GitHub issueif use [component].module.less, will be cause error as follow
./src/pages/Login/Login.module.less (./node_modules/css-loader/dist/cjs.js??ref–6-oneOf-8-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref–6-oneOf-8-3!./src/pages/Login/Login.module.less) ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema. - options has an unknown property ‘localIdentName’. These properties are valid: object { url?, import?, modules?, sourceMap?, importLoaders?, localsConvention?, onlyLocals?, esModule? }
this is a break changes in css-loader. css-loader#2197 default config like this
{
test: lessModuleRegex,
use: getLessLoader({
importLoaders: 2,
modules: { localIdentName: localIdentName}
})
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:5
Top Results From Across the Web
Using .less files with React - Stack Overflow
to use less files in a react project created with create-react-app follow these steps: npm run eject; npm i less less-loader ...
Read more >Use in create-react-app - Ant Design
create -react-app is one of the best React application development tools. We are going to use antd within it and modify the webpack...
Read more >react-app-rewired - npm
1) Install react-app-rewired · 2) Create a config-overrides.js file in the root directory · 3) 'Flip' the existing calls to react-scripts in npm ......
Read more >Create React App without Create React App - Bits and Pieces
This article talks about the process of creating react app without using any libraries or frameworks such as “create-react-app” , “NextJS” etc.
Read more >Using LESS CSS with the latest Create React App-Reactjs
"style" loader turns CSS into JS modules that inject <style> tags. // In production, we use MiniCSSExtractPlugin to extract that CSS // to...
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
Just tried
customize-cra@next
, it works now.不要在代码中使用 xxx.module.less,使用xxx.less然后引用,或者是参考上面的把custom_cra那一块给改掉就可以了。