question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

about less modules

See original GitHub issue

my code is as follows config-overrides.js

const { override, fixBabelImports, addLessLoader } = require('customize-cra');

module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd',
    libraryDirectory: 'es',
    style: true,
  }),
  addLessLoader({
      localIdentName: "[name]__[local]--[hash:base64:5]",
    javascriptEnabled: true,
    modifyVars: { '@primary-color': '#25b864' },
  }),
);

There’s no problem when it’s used like this import './index.less';

I want to use a. Less file like this

import styles from './index.less';
import cls from 'classnames';

When I print like this console.log('styles:',styles) the result is {}

When I change the .less file to the .module.less file, an error will be reported again

why?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

6reactions
unsafeFunctioncommented, Apr 3, 2020

@shx996 This is not working in my case. Now I get an error
`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? } `
2reactions
ghostcommented, Mar 30, 2020

Right:xxx.module.less

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started | Less.js
Less extends CSS with dynamic behavior such as variables, mixins, operations and functions. Less runs on both the server-side (with Node.js and Rhino)...
Read more >
CSS Modules vs Less | What are the differences? - StackShare
Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques...
Read more >
React + CSS Modules + LESS + Webpack 4 | by Joe Crick
What I wanted to do was setup my app to use CSS Modules. ... Setup and configuration of LESS + CSS Modules in...
Read more >
less-loader | webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Can I use css-modules with LESS + nesting? - Stack Overflow
I think it's more clear which styles build on top of other styles if I can actually nest them in code. But I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found