Skip to content

addLessLoader issue when using less-loader #241

@luchobertello

Description

@luchobertello

I'm using react-app-rewired and I've recently updated less-loader to the new version (6.0.0). My customize-cra version is 0.9.1.

I'm getting the following error when I run react-app-rewired build:

ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.
options has an unknown property 'source'. These properties are valid:
object { lessOptions?, prependData?, appendData?, sourceMap? }

I've the config-overrides.js file like this:

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

module.exports = override(
  fixBabelImports("import", {
    libraryName: "antd",
    libraryDirectory: "es",
    style: true
  }),
  addLessLoader({
    lessOptions: {
      javascriptEnabled: true,
      modifyVars: {
        "@primary-color": "#030852", // primary color for all components
      }
    }
  })
);

I added the lessOptions object but it didn't solve the problem.
Could you tell me which is the proper way to set addLessLoader options?

Thanks in advance,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions