-
Notifications
You must be signed in to change notification settings - Fork 48
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
module.less not work #56
Comments
me too |
1 similar comment
me too |
ok, that work for me, but module less don't save selectors hierarchy inside, how can that I correct? for example btn selector doesn't will be to use(
|
const CracoLessPlugin = require('craco-less'); const path = require('path'); const lessModifyVars = {}; module.exports = { plugins: [ { plugin: CracoLessPlugin, options: { lessLoaderOptions: { lessOptions: { modifyVars: lessModifyVars, javascriptEnabled: true, }, }, modifyLessRule: function (lessRule, _context) { lessRule.test = /\.less$/; lessRule.exclude = /\.module\.less$/; return lessRule; }, }, }, { plugin: CracoLessPlugin, options: { lessLoaderOptions: { lessOptions: { modifyVars: lessModifyVars, javascriptEnabled: true, }, }, modifyLessRule: function (lessRule, _context) { lessRule.test = /\.module\.less$/; lessRule.exclude = undefined; return lessRule; }, cssLoaderOptions: { modules: { localIdentName: '[local]_[hash:base64:5]' }, }, }, }, ], }; |
@LevapVeeskela Thank you for your answer ! |
this work for me {
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: lessModifyVars,
javascriptEnabled: true,
},
},
modifyLessModuleRule(lessModuleRule, context) {
lessModuleRule.test = /\.module\.(less)$/
const cssLoader = lessModuleRule.use.find(loaderByName("css-loader"));
cssLoader.options.importLoaders = 4,
cssLoader.options.modules = {
localIdentName: "[local]_[hash:base64:5]",
};
return lessModuleRule;
},
},
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to use module.less in my app, but it doesn't work, the style was not applied. please help, this is my craco.config.js file:
craco-less version: 1.17.1
and this is my tsx and style file, they were in the same dir.
AppHeader.tsx
import './AppHeader.module.less';
// import style fileAppHeader.module.less
The text was updated successfully, but these errors were encountered: