{"_id":"less-loader@13.1.0","bugs":{"url":"https://github.com/webpack/less-loader/issues"},"dist":{"shasum":"8c74441e37d804613e263968a0d00c1298825e50","tarball":"http://registry-npm.ywwl.com/less-loader/download/less-loader-13.1.0.tgz","fileCount":13,"integrity":"sha512-oUzF3nuumJeMbYSwCVcEb/DwNn+0R/YdeC9OLIf+oQqcwF2/I42Z4972aNPxUy6R8uEkNdX6vEhYs45T+wiooQ==","signatures":[{"sig":"MEUCIFOBiZi834hJkz/GeIcv51Ivfj1cWldaFF4Bkqy1IZg1AiEA+I4gUTxF2Sp2Sk5muOK+lcxfz6dLCLVXiO2mgtbjAWg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC26avAQPOn2fUR4o9qIIrJ46Hvjp+dKo8kH3hyE5Lv0AIhAK50QvoRUroXn8llrcmw1qYaJunwNS227UMiCBQzZYPD"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/less-loader@13.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":71511,"size":14477,"noattachment":false,"key":"/less-loader/-/less-loader-13.1.0.tgz"},"main":"./dist/cjs/index.js","name":"less-loader","type":"module","types":"./types/index.d.ts","author":{"name":"Johannes Ewald @jhnns"},"module":"./dist/esm/index.js","engines":{"node":">= 22.11.0"},"exports":{".":{"types":"./types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./package.json":"./package.json"},"funding":{"url":"https://opencollective.com/webpack","type":"opencollective"},"gitHead":"7a40320f52181807420b041bf4f6ca7f14fed274","license":"MIT","scripts":{"fix":"npm run fix:code && npm run fmt","fmt":"npm run fmt:check -- --write","lint":"npm-run-all -l -p \"lint:**\" && npm run fmt:check","test":"npm run test:base","build":"npm-run-all -p \"build:*\"","clean":"del-cli dist","start":"npm run build -- -w","prepare":"husky && npm run build","pretest":"npm run lint","release":"npm run build && changeset publish","version":"changeset version","fix:code":"npm run lint:code -- --fix","prebuild":"npm run clean","security":"npm audit --production","build:cjs":"babel src -d dist/cjs --env-name cjs --copy-files --no-copy-ignored && node -e \"const fs=require('fs');fs.writeFileSync('dist/cjs/package.json','{\\\"type\\\":\\\"commonjs\\\"}\\n');fs.appendFileSync('dist/cjs/index.js','module.exports = exports.default;\\nmodule.exports.default = exports.default;\\n')\"","build:esm":"babel src -d dist/esm --env-name esm --copy-files --no-copy-ignored && node -e \"require('fs').writeFileSync('dist/esm/package.json','{\\\"type\\\":\\\"module\\\"}\\n')\"","fmt:check":"prettier --list-different --cache --ignore-unknown .","lint:code":"eslint --cache .","test:base":"node --import ./test/setup-snapshots.js --test --test-force-exit --test-reporter=dot --test-reporter-destination=stdout --experimental-test-module-mocks","lint:types":"tsc --pretty --noEmit","build:types":"tsc && prettier \"types/**/*.ts\" --write","lint:spelling":"cspell --cache --no-must-find-files --quiet \"**/*.*\"","test:coverage":"npm run test:base -- --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage.lcov --test-coverage-include=\"src/**/*.js\""},"version":"13.1.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"9a3e59df-8a2f-4870-a81c-0910700ed884"}},"homepage":"https://github.com/webpack/less-loader","keywords":["webpack","loader","less","lesscss","less.js","css","preprocessor"],"repository":{"url":"git+https://github.com/webpack/less-loader.git","type":"git"},"_npmVersion":"11.19.0","description":"A Less loader for webpack. Compiles Less to CSS.","directories":{},"maintainers":[{"name":"evilebottnawi","email":"sheo13666q@gmail.com"},{"name":"sokra","email":"tobias.koppers@googlemail.com"},{"name":"jhnns","email":"mail@johannesewald.de"},{"name":"15000621931","email":"784487301@qq.com"},{"name":"ev1stensberg","email":"evenstensberg@gmail.com"},{"name":"__hai","email":"haijie0619@gmail.com"},{"name":"avivkeller","email":"me@aviv.sh"}],"_nodeVersion":"24.21.0","dependencies":{"@types/less":"^3.0.8"},"_hasShrinkwrap":false,"devDependencies":{"del":"^8.0.1","less":"^4.6.5","husky":"^9.1.3","memfs":"^4.57.2","cspell":"^10.0.0","eslint":"^9.32.0","del-cli":"^7.0.0","webpack":"^5.107.0","prettier":"^3.8.3","@babel/cli":"^7.24.7","typescript":"^6.0.3","@babel/core":"^7.29.6","@types/node":"^22.13.4","lint-staged":"^17.0.5","npm-run-all":"^4.1.5","@changesets/cli":"^2.30.0","less-plugin-glob":"^3.0.0","@babel/preset-env":"^7.29.5","eslint-config-webpack":"^4.9.6","@changesets/get-github-info":"^0.8.0"},"peerDependencies":{"less":"^3.5.0 || ^4.0.0","webpack":"^5.0.0","@rspack/core":"0.x || ^1.0.0 || ^2.0.0-0"},"peerDependenciesMeta":{"webpack":{"optional":true},"@rspack/core":{"optional":true}},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/less-loader_13.1.0_1793122142453_0.6315533031631463"},"readme":"<div align=\"center\">\n  <a href=\"https://github.com/webpack/webpack\">\n    <img width=\"200\" height=\"200\" src=\"https://webpack.js.org/assets/icon-square-big.svg\">\n  </a>\n</div>\n\n[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![tests][tests]][tests-url]\n[![cover][cover]][cover-url]\n[![discussion][discussion]][discussion-url]\n[![size][size]][size-url]\n\n# less-loader\n\nA Less loader for webpack that compiles Less files into CSS.\n\n## Getting Started\n\nTo begin, you'll need to install `less` and `less-loader`:\n\n```console\nnpm install less less-loader --save-dev\n```\n\nor\n\n```console\nyarn add -D less less-loader\n```\n\nor\n\n```console\npnpm add -D less less-loader\n```\n\nThen add the loader to your `webpack` configuration. For example:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        // Uses the built-in CSS support of webpack, i.e. `.module.less` files\n        // are treated as CSS modules, other files are treated as plain CSS\n        type: \"css/auto\",\n        // Compiles Less to CSS\n        use: [\"less-loader\"],\n      },\n    ],\n  },\n  experiments: {\n    // Enables the built-in CSS support of webpack\n    css: true,\n  },\n};\n```\n\n> [!NOTE]\n>\n> The built-in CSS support of webpack requires `experiments.css` to be enabled.\n> Alternatively you can still chain the loader with [`css-loader`](https://github.com/webpack/css-loader) and [`style-loader`](https://github.com/webpack/style-loader) (or the [`mini-css-extract-plugin`](https://github.com/webpack/mini-css-extract-plugin)), see [Using `css-loader` and `style-loader`](#using-css-loader-and-style-loader).\n\nFinally, run `webpack` using the method you normally use (e.g., via CLI or an npm script).\n\n## Options\n\n- **[`lessOptions`](#lessoptions)**\n- **[`additionalData`](#additionalData)**\n- **[`sourceMap`](#sourcemap)**\n- **[`webpackImporter`](#webpackimporter)**\n- **[`implementation`](#implementation)**\n- **[`lessLogAsWarnOrErr`](#lesslogaswarnorerr)**\n\n### `lessOptions`\n\nType:\n\n<!-- eslint-skip -->\n\n```ts\ntype lessOptions = import('less').options | ((loaderContext: LoaderContext) => import('less').options})\n```\n\nDefault: `{ relativeUrls: true }`\n\nYou can pass any Less specific options to the `less-loader` through the `lessOptions` property in the [loader options](https://webpack.js.org/configuration/module/#ruleoptions--rulequery). See the [Less documentation](http://lesscss.org/usage/#command-line-usage-options) for all available options in dash-case.\n\nSince we're passing these options to Less programmatically, you need to pass them in camelCase here:\n\n#### `object`\n\nUse an object to pass options directly to Less.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              lessOptions: {\n                strictMath: true,\n              },\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n#### `function`\n\nAllows setting the Less options dynamically based on the loader context.\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              lessOptions: (loaderContext) => {\n                // More information about available properties https://webpack.js.org/api/loaders/\n                const { resourcePath, rootContext } = loaderContext;\n                const relativePath = path.relative(rootContext, resourcePath);\n\n                if (relativePath === \"styles/foo.less\") {\n                  return {\n                    paths: [\"absolute/path/c\", \"absolute/path/d\"],\n                  };\n                }\n\n                return {\n                  paths: [\"absolute/path/a\", \"absolute/path/b\"],\n                };\n              },\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n### `additionalData`\n\nType:\n\n```ts\ntype additionalData =\n  | string\n  | ((content: string, loaderContext: LoaderContext) => string);\n```\n\nDefault: `undefined`\n\nPrepends or Appends `Less` code to the actual entry file.\nIn this case, the `less-loader` will not override the source but just **prepend** the entry's content.\n\nThis is especially useful when some of your Less variables depend on the environment.\n\n> Since you're injecting code, this will break the source mappings in your entry file. Often there's a simpler solution than this, like multiple Less entry files.\n\n#### `string`\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              additionalData: `@env: ${process.env.NODE_ENV};`,\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n#### `function`\n\n##### `Sync`\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              additionalData: (content, loaderContext) => {\n                // More information about available properties https://webpack.js.org/api/loaders/\n                const { resourcePath, rootContext } = loaderContext;\n                const relativePath = path.relative(rootContext, resourcePath);\n\n                if (relativePath === \"styles/foo.less\") {\n                  return `@value: 100px;${content}`;\n                }\n\n                return `@value: 200px;${content}`;\n              },\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n##### `Async`\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              additionalData: async (content, loaderContext) => {\n                // More information about available properties https://webpack.js.org/api/loaders/\n                const { resourcePath, rootContext } = loaderContext;\n                const relativePath = path.relative(rootContext, resourcePath);\n\n                if (relativePath === \"styles/foo.less\") {\n                  return `@value: 100px;${content}`;\n                }\n\n                return `@value: 200px;${content}`;\n              },\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n### `sourceMap`\n\nType:\n\n```ts\ntype sourceMap = boolean;\n```\n\nDefault: depends on the `compiler.devtool` value\n\nBy default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.\nAll values enable source map generation except `eval` and `false` value.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              sourceMap: true,\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n### `webpackImporter`\n\nType:\n\n```ts\ntype webpackImporter = boolean | \"only\";\n```\n\nDefault: `true`\n\nEnables or disables the default `webpack` importer.\n\nThis can improve performance in some cases. Use it with caution because aliases and `@import` from [`node_modules`](https://webpack.js.org/configuration/resolve/#resolvemodules) will not work.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              webpackImporter: false,\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n### `implementation`\n\nType:\n\n```ts\ntype implementation = object | string;\n```\n\n> less-loader compatible with both Less 3 and 4 versions\n\nThe special `implementation` option determines which implementation of Less to use. Overrides the locally installed `peerDependency` version of `less`.\n\n**This option is only really useful for downstream tooling authors to ease the Less 3-to-4 transition.**\n\n#### `object`\n\nExample using a Less instance:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              implementation: require(\"less\"),\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n#### `string`\n\nExample using a resolved Less module path:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              implementation: require.resolve(\"less\"),\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n### `lessLogAsWarnOrErr`\n\nType:\n\n```ts\ntype lessLogAsWarnOrErr = boolean;\n```\n\nDefault: `true`\n\n`Less` warnings and errors will be treated as webpack warnings and errors, instead of being logged silently.\n\n**warning.less**\n\n```less\ndiv {\n  &:extend(.body1);\n}\n```\n\nIf `lessLogAsWarnOrErr` is set to `false` it will be just a log and webpack will compile successfully, but if you leave the default value (or set this option to `true`) webpack will compile fail with a warning(or error), and can break the build if configured accordingly.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              lessLogAsWarnOrErr: true,\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n## Examples\n\n### Normal usage\n\nSet the module `type` to `css/auto` and enable `experiments.css` to let webpack handle the generated CSS with its built-in CSS support, without any extra loaders or plugins.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\", // Handles the generated CSS using the built-in CSS support of webpack\n        use: [\"less-loader\"], // Compiles Less to CSS\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\nThe `css/auto` module type treats `*.module.less` files as [CSS modules](#css-modules) and any other file as plain CSS.\nUse `type: \"css\"` to always treat the file as plain CSS, or `type: \"css/module\"` to always treat it as a CSS module.\n\nUnfortunately, Less doesn't map all options 1-by-1 to camelCase. When in doubt, [check their executable](https://github.com/less/less.js/blob/3.x/bin/lessc) and search for the dash-case option.\n\n### Using `css-loader` and `style-loader`\n\nThe built-in CSS support of webpack is not mandatory, you can still chain the `less-loader` with [`css-loader`](https://github.com/webpack/css-loader) and [`style-loader`](https://github.com/webpack/style-loader) to immediately apply all styles to the DOM.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        use: [\n          {\n            loader: \"style-loader\", // Creates style nodes from JS strings\n          },\n          {\n            loader: \"css-loader\", // Translates CSS into CommonJS\n          },\n          {\n            loader: \"less-loader\", // Compiles Less to CSS\n          },\n        ],\n      },\n    ],\n  },\n};\n```\n\nNote that in this case the `type` and `experiments.css` options should not be set for this rule, and options like `sourceMap` have to be enabled for the `css-loader` too.\n\n### Source maps\n\nTo enable sourcemaps for CSS, you'll need to pass the `sourceMap` property in the loader's options. If this is not passed, the loader will respect the setting for webpack source maps, set in `devtool`.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  devtool: \"source-map\", // any \"source-map\"-like devtool is possible\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              sourceMap: true,\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\nIf you want to edit the original Less files inside Chrome, [there's a good blog post](https://medium.com/@toolmantim/getting-started-with-css-sourcemaps-and-in-browser-sass-editing-b4daab987fb0). The blog post is about Sass but it also works for Less.\n\n### In production\n\nThe built-in CSS support of webpack always extracts style sheets into dedicated files, so your styles are not dependent on JavaScript, which improves performance and cacheability.\nThe name of the generated files can be configured using the [`output.cssFilename`](https://webpack.js.org/configuration/output/#outputcssfilename) and [`output.cssChunkFilename`](https://webpack.js.org/configuration/output/#outputcsschunkfilename) options.\n\nWhen you chain the loader with `css-loader` and `style-loader` instead, it's recommended to extract the style sheets into a dedicated file in production using the [MiniCssExtractPlugin](https://github.com/webpack/mini-css-extract-plugin).\n\n### Imports\n\nFirst we try to use built-in `less` resolve logic, then `webpack` resolve logic.\n\n#### Webpack Resolver\n\n`webpack` provides an [advanced mechanism to resolve files](https://webpack.js.org/configuration/resolve/).\n`less-loader` applies a Less plugin that passes all queries to the webpack resolver if `less` could not resolve `@import`.\nThus you can import your Less modules from `node_modules`.\n\n```css\n@import \"bootstrap/less/bootstrap\";\n```\n\nUsing `~` prefix (e.g., @import \"~bootstrap/less/bootstrap\";) is deprecated and can be removed from your code (**we recommend it**), but we still support it for historical reasons.\nWhy you can removed it? The loader will first try to resolve `@import` as relative, if it cannot be resolved, the loader will try to resolve `@import` inside [`node_modules`](https://webpack.js.org/configuration/resolve/#resolvemodules).\n\nDefault resolver options can be modified by [`resolve.byDependency`](https://webpack.js.org/configuration/resolve/#resolvebydependency):\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  devtool: \"source-map\", // any \"source-map\"-like devtool is possible\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\"less-loader\"],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n  resolve: {\n    byDependency: {\n      // More options can be found here https://webpack.js.org/configuration/resolve/\n      less: {\n        mainFiles: [\"custom\"],\n      },\n    },\n  },\n};\n```\n\n#### Less Resolver\n\nIf you specify the `paths` option, modules will be searched in the given `paths`. This is `less` default behavior. `paths` should be an array with absolute paths:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\n          {\n            loader: \"less-loader\",\n            options: {\n              lessOptions: {\n                paths: [path.resolve(__dirname, \"node_modules\")],\n              },\n            },\n          },\n        ],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n### Plugins\n\nIn order to use [Less plugins](http://lesscss.org/usage/#plugins), simply set the `plugins` option like this:\n\n**webpack.config.js**\n\n<!-- eslint-skip -->\n\n```js\nconst CleanCSSPlugin = require('less-plugin-clean-css');\n\nmodule.exports = {\n  ...\n    {\n      loader: 'less-loader',\n      options: {\n        lessOptions: {\n          plugins: [\n            new CleanCSSPlugin({ advanced: true }),\n          ],\n        },\n      },\n    },\n  ...\n};\n```\n\n> [!NOTE]\n>\n> Access to the [loader context](https://webpack.js.org/api/loaders/#the-loader-context) inside a custom plugin can be done using the `pluginManager.webpackLoaderContext` property.\n\n```js\nmodule.exports = {\n  install(less, pluginManager, functions) {\n    functions.add(\n      \"pi\",\n      () =>\n        // Loader context is available in `pluginManager.webpackLoaderContext`\n\n        Math.PI,\n    );\n  },\n};\n```\n\n### Extracting style sheets\n\nBundling CSS with webpack has some nice advantages like referencing images and fonts with hashed urls or [Hot Module Replacement(HMR)](https://webpack.js.org/concepts/hot-module-replacement/) in development.\n\nIn production, on the other hand, it's not a good idea to apply your style sheets depending on JS execution. Rendering may be delayed or even a [FOUC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content) might be visible. Thus it's often still better to have them as separate files in your final production build.\n\nThe built-in CSS support of webpack does this out of the box: every entry point and chunk gets its own style sheet, no extra plugin required.\nWhen you chain the loader with the `css-loader` instead, use the [`MiniCssExtractPlugin`](https://github.com/webpack/mini-css-extract-plugin) to extract a style sheet from the bundle.\n\n### CSS modules\n\nWith the built-in CSS support of webpack, `*.module.less` files are treated as [CSS modules](https://github.com/css-modules/css-modules) when the module `type` is `css/auto`, and all files are treated as CSS modules when the module `type` is `css/module`:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.less$/i,\n        type: \"css/auto\",\n        use: [\"less-loader\"],\n      },\n    ],\n  },\n  experiments: {\n    css: true,\n  },\n};\n```\n\n**index.js**\n\n```js\nimport * as styles from \"./style.module.less\";\n\ndocument.body.className = styles.box;\n```\n\nThere is a known problem when using Less with CSS modules regarding relative file paths in `url(...)` statements.\n[See this issue for an explanation](https://github.com/webpack/less-loader/issues/109#issuecomment-253797335).\n\n## Contributing\n\nWe welcome all contributions!\nIf you're new here, please take a moment to review our contributing guidelines before submitting issues or pull requests.\n\n[CONTRIBUTING](https://github.com/webpack/less-loader?tab=contributing-ov-file#contributing)\n\n## License\n\n[MIT](./LICENSE)\n\n[npm]: https://img.shields.io/npm/v/less-loader.svg\n[npm-url]: https://npmjs.com/package/less-loader\n[node]: https://img.shields.io/node/v/less-loader.svg\n[node-url]: https://nodejs.org\n[tests]: https://github.com/webpack/less-loader/workflows/less-loader/badge.svg\n[tests-url]: https://github.com/webpack/less-loader/actions\n[cover]: https://codecov.io/gh/webpack/less-loader/branch/main/graph/badge.svg\n[cover-url]: https://codecov.io/gh/webpack/less-loader\n[discussion]: https://img.shields.io/github/discussions/webpack/webpack\n[discussion-url]: https://github.com/webpack/webpack/discussions\n[size]: https://packagephobia.now.sh/badge?p=less-loader\n[size-url]: https://packagephobia.now.sh/result?p=less-loader\n","publish_time":1793122142532,"_cnpm_publish_time":1793122142532,"dist-tags":{"latest":"13.1.0"}}