I was getting this error when I moved from less-loader
version 6.0.0 to version 6.1.0 when trying to load my Ant Design library into my front-end with Webpack. I wanted to know if anyone else had this issue and resolved it (I answered it below).
Here was my LESS compilation configuration before the update:
module: { rules: [{
test: /\.less$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{
loader: "less-loader",
options: {
javascriptEnabled: true,
}
}
]
}]}
ERROR in ./node_modules/.pnpm/registry.npmjs.org/antd/[email protected][email protected]/node_modules/antd/dist/antd.less (./node_modules/.pnpm/registry.npmjs.org/css-loader/[email protected]/node_modules/css-loader/dist/cjs.js!./node_modules/.pnpm/registry.npmjs.org/less-loader/[email protected]/node_modules/less-loader/dist/cjs.js??ref--6-2!./node_modules/.pnpm/registry.npmjs.org/antd/[email protected][email protected]/node_modules/antd/dist/antd.less)
Module build failed (from ./node_modules/.pnpm/registry.npmjs.org/less-loader/[email protected]/node_modules/less-loader/dist/cjs.js):
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 'javascriptEnabled'. These properties are valid:
object { lessOptions?, prependData?, appendData?, sourceMap?, implementation? }
at validate (/home/<path>/react-web/node_modules/.pnpm/registry.npmjs.org/schema-utils/2.6.6/node_modules/schema-utils/dist/validate.js:88:11)
at Object.lessLoader (/home/<path>/react-web/node_modules/.pnpm/registry.npmjs.org/less-loader/[email protected]/node_modules/less-loader/dist/index.js:22:28)
@ ./node_modules/.pnpm/registry.npmjs.org/antd/[email protected][email protected]/node_modules/antd/dist/antd.less 2:26-228
@ ./src/index.tsx
@ multi ./src/index.tsx