Skip to content

Commit 6a682b8

Browse files
chore(release): 8.0.0
1 parent 99d80bd commit 6a682b8

File tree

4 files changed

+49
-4
lines changed

4 files changed

+49
-4
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [8.0.0](https://github.com/webpack-contrib/less-loader/compare/v7.3.0...v8.0.0) (2021-02-01)
6+
7+
8+
### Notes
9+
10+
* using `~` is deprecated and can be removed from your code (**we recommend it**), but we still support it for historical reasons.
11+
12+
Why you can removed it?
13+
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/#resolve-modules).
14+
15+
### ⚠ BREAKING CHANGES
16+
17+
* minimum supported `webpack` version is `5`
18+
19+
### Features
20+
21+
* supported the [`resolve.byDependency`](https://webpack.js.org/configuration/resolve/#resolvebydependency) option, you can setup `{ resolve: { byDependency: { less: { mainFiles: ['custom', '...'] } } } }`
22+
523
## [7.3.0](https://github.com/webpack-contrib/less-loader/compare/v7.2.1...v7.3.0) (2021-01-21)
624

725

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ To enable sourcemaps for CSS, you'll need to pass the `sourceMap` property in th
382382

383383
**webpack.config.js**
384384

385-
```javascript
385+
```js
386386
module.exports = {
387387
devtool: "source-map", // any "source-map"-like devtool is possible
388388
module: {
@@ -438,6 +438,32 @@ Just prepend them with a `~` which tells webpack to look up the [`modules`](http
438438
@import "~bootstrap/less/bootstrap";
439439
```
440440

441+
Default resolver options can be modified by [`resolve.byDependency`](https://webpack.js.org/configuration/resolve/#resolvebydependency):
442+
443+
**webpack.config.js**
444+
445+
```js
446+
module.exports = {
447+
devtool: "source-map", // any "source-map"-like devtool is possible
448+
module: {
449+
rules: [
450+
{
451+
test: /\.less$/i,
452+
use: ["style-loader", "css-loader", "less-loader"],
453+
},
454+
],
455+
},
456+
resolve: {
457+
byDependency: {
458+
// More options can be found here https://webpack.js.org/configuration/resolve/
459+
less: {
460+
mainFiles: ["custom"],
461+
},
462+
},
463+
},
464+
};
465+
```
466+
441467
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";`
442468

443469
#### Less Resolver
@@ -478,8 +504,9 @@ module.exports = {
478504

479505
In order to use [plugins](http://lesscss.org/usage/#plugins), simply set the `plugins` option like this:
480506

507+
**webpack.config.js**
508+
481509
```js
482-
// webpack.config.js
483510
const CleanCSSPlugin = require('less-plugin-clean-css');
484511

485512
module.exports = {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "less-loader",
3-
"version": "7.3.0",
3+
"version": "8.0.0",
44
"description": "A Less loader for webpack. Compiles Less to CSS.",
55
"license": "MIT",
66
"repository": "webpack-contrib/less-loader",

0 commit comments

Comments
 (0)