less-loader 11.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -14
- package/dist/utils.js +1 -1
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
[![npm][npm]][npm-url]
|
|
8
8
|
[![node][node]][node-url]
|
|
9
|
-
[![deps][deps]][deps-url]
|
|
10
9
|
[![tests][tests]][tests-url]
|
|
11
10
|
[![cover][cover]][cover-url]
|
|
12
11
|
[![chat][chat]][chat-url]
|
|
@@ -320,7 +319,7 @@ Default: `true`
|
|
|
320
319
|
|
|
321
320
|
Enables/Disables the default `webpack` importer.
|
|
322
321
|
|
|
323
|
-
This can improve performance in some cases. Use it with caution because aliases and `@import`
|
|
322
|
+
This 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.
|
|
324
323
|
|
|
325
324
|
**webpack.config.js**
|
|
326
325
|
|
|
@@ -487,7 +486,7 @@ Usually, it's recommended to extract the style sheets into a dedicated file in p
|
|
|
487
486
|
|
|
488
487
|
### Imports
|
|
489
488
|
|
|
490
|
-
First we try to use built-in `less` resolve logic, then `webpack` resolve logic
|
|
489
|
+
First we try to use built-in `less` resolve logic, then `webpack` resolve logic.
|
|
491
490
|
|
|
492
491
|
#### Webpack Resolver
|
|
493
492
|
|
|
@@ -500,12 +499,7 @@ Thus you can import your Less modules from `node_modules`.
|
|
|
500
499
|
```
|
|
501
500
|
|
|
502
501
|
Using `~` is deprecated and can be removed from your code (**we recommend it**), but we still support it for historical reasons.
|
|
503
|
-
Why 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/#
|
|
504
|
-
Just prepend them with a `~` which tells webpack to look up the [`modules`](https://webpack.js.org/configuration/resolve/#resolve-modules).
|
|
505
|
-
|
|
506
|
-
```css
|
|
507
|
-
@import "~bootstrap/less/bootstrap";
|
|
508
|
-
```
|
|
502
|
+
Why 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).
|
|
509
503
|
|
|
510
504
|
Default resolver options can be modified by [`resolve.byDependency`](https://webpack.js.org/configuration/resolve/#resolvebydependency):
|
|
511
505
|
|
|
@@ -533,8 +527,6 @@ module.exports = {
|
|
|
533
527
|
};
|
|
534
528
|
```
|
|
535
529
|
|
|
536
|
-
It's important to only prepend it with `~`, because `~/` resolves to the home-directory. webpack needs to distinguish between `bootstrap` and `~bootstrap`, because CSS and Less files have no special syntax for importing relative files. Writing `@import "file"` is the same as `@import "./file";`
|
|
537
|
-
|
|
538
530
|
#### Less Resolver
|
|
539
531
|
|
|
540
532
|
If 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:
|
|
@@ -594,7 +586,9 @@ module.exports = {
|
|
|
594
586
|
};
|
|
595
587
|
```
|
|
596
588
|
|
|
597
|
-
>
|
|
589
|
+
> **Note**
|
|
590
|
+
>
|
|
591
|
+
> Access to the [loader context](https://webpack.js.org/api/loaders/#the-loader-context) inside the custom plugin can be done using the `pluginManager.webpackLoaderContext` property.
|
|
598
592
|
|
|
599
593
|
```js
|
|
600
594
|
module.exports = {
|
|
@@ -635,8 +629,6 @@ Please take a moment to read our contributing guidelines if you haven't yet done
|
|
|
635
629
|
[npm-url]: https://npmjs.com/package/less-loader
|
|
636
630
|
[node]: https://img.shields.io/node/v/less-loader.svg
|
|
637
631
|
[node-url]: https://nodejs.org
|
|
638
|
-
[deps]: https://david-dm.org/webpack-contrib/less-loader.svg
|
|
639
|
-
[deps-url]: https://david-dm.org/webpack-contrib/less-loader
|
|
640
632
|
[tests]: https://github.com/webpack-contrib/less-loader/workflows/less-loader/badge.svg
|
|
641
633
|
[tests-url]: https://github.com/webpack-contrib/less-loader/actions
|
|
642
634
|
[cover]: https://codecov.io/gh/webpack-contrib/less-loader/branch/master/graph/badge.svg
|
package/dist/utils.js
CHANGED
|
@@ -42,7 +42,7 @@ const MODULE_REQUEST_REGEX = /^[^?]*~/;
|
|
|
42
42
|
function createWebpackLessPlugin(loaderContext, implementation) {
|
|
43
43
|
const resolve = loaderContext.getResolve({
|
|
44
44
|
dependencyType: "less",
|
|
45
|
-
conditionNames: ["less", "style"],
|
|
45
|
+
conditionNames: ["less", "style", "..."],
|
|
46
46
|
mainFields: ["less", "style", "main", "..."],
|
|
47
47
|
mainFiles: ["index", "..."],
|
|
48
48
|
extensions: [".less", ".css"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less-loader",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "A Less loader for webpack. Compiles Less to CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/less-loader",
|
|
@@ -44,30 +44,30 @@
|
|
|
44
44
|
"klona": "^2.0.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/cli": "^7.
|
|
48
|
-
"@babel/core": "^7.
|
|
49
|
-
"@babel/preset-env": "^7.
|
|
50
|
-
"@commitlint/cli": "^17.
|
|
51
|
-
"@commitlint/config-conventional": "^17.
|
|
47
|
+
"@babel/cli": "^7.19.3",
|
|
48
|
+
"@babel/core": "^7.19.3",
|
|
49
|
+
"@babel/preset-env": "^7.19.3",
|
|
50
|
+
"@commitlint/cli": "^17.1.2",
|
|
51
|
+
"@commitlint/config-conventional": "^17.1.0",
|
|
52
52
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
53
|
-
"babel-jest": "^
|
|
53
|
+
"babel-jest": "^29.1.2",
|
|
54
54
|
"cross-env": "^7.0.3",
|
|
55
|
-
"del": "^6.
|
|
55
|
+
"del": "^6.1.1",
|
|
56
56
|
"del-cli": "^4.0.1",
|
|
57
|
-
"eslint": "^8.
|
|
57
|
+
"eslint": "^8.24.0",
|
|
58
58
|
"eslint-config-prettier": "^8.3.0",
|
|
59
59
|
"eslint-plugin-import": "^2.24.1",
|
|
60
60
|
"husky": "^8.0.1",
|
|
61
|
-
"jest": "^
|
|
62
|
-
"less": "^4.1.
|
|
63
|
-
"less-plugin-glob": "^
|
|
64
|
-
"lint-staged": "^12.
|
|
65
|
-
"memfs": "^3.
|
|
61
|
+
"jest": "^29.1.2",
|
|
62
|
+
"less": "^4.1.3",
|
|
63
|
+
"less-plugin-glob": "^2.0.2",
|
|
64
|
+
"lint-staged": "^12.5.0",
|
|
65
|
+
"memfs": "^3.4.7",
|
|
66
66
|
"npm-run-all": "^4.1.5",
|
|
67
|
-
"prettier": "^2.
|
|
67
|
+
"prettier": "^2.7.1",
|
|
68
68
|
"standard-version": "^9.3.1",
|
|
69
69
|
"strip-ansi": "^7.0.0",
|
|
70
|
-
"webpack": "^5.
|
|
70
|
+
"webpack": "^5.74.0"
|
|
71
71
|
},
|
|
72
72
|
"keywords": [
|
|
73
73
|
"webpack",
|