sass-loader 16.0.1 → 16.0.3
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 +13 -11
- package/dist/utils.js +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,11 +98,11 @@ module.exports = {
|
|
|
98
98
|
|
|
99
99
|
Finally run `webpack` via your preferred method.
|
|
100
100
|
|
|
101
|
-
### The `
|
|
101
|
+
### The `style` (new API, by default since 16 version) and `outputStyle` (old API) options in `production` mode
|
|
102
102
|
|
|
103
|
-
For `production` mode, the `
|
|
103
|
+
For `production` mode, the `style` (new API, by default since 16 version) and `outputStyle` (old API) options default to `compressed` unless otherwise specified in `sassOptions`.
|
|
104
104
|
|
|
105
|
-
### Resolving `import` at-rules
|
|
105
|
+
### Resolving `import` and `use` at-rules
|
|
106
106
|
|
|
107
107
|
Webpack provides an [advanced mechanism to resolve files](https://webpack.js.org/concepts/module-resolution/).
|
|
108
108
|
|
|
@@ -296,13 +296,13 @@ Options for [Dart Sass](http://sass-lang.com/dart-sass) or [Node Sass](https://g
|
|
|
296
296
|
|
|
297
297
|
> [!NOTE]
|
|
298
298
|
>
|
|
299
|
-
> The `indentedSyntax` option is `
|
|
299
|
+
> The `syntax` (new API, by default since 16 version)`and`indentedSyntax`(old API) option is`scss`for the`scss`extension,`indented`for the`sass`extension and`css`for the`css` extension.
|
|
300
300
|
|
|
301
301
|
> [!NOTE]
|
|
302
302
|
>
|
|
303
303
|
> Options such as `data` and `file` are unavailable and will be ignored.
|
|
304
304
|
|
|
305
|
-
> ℹ We strongly discourage changing the `outFile
|
|
305
|
+
> ℹ We strongly discourage changing the `sourceMap` (new API, by default since 16 version), `outFile` (old API), `sourceMapContents` (old API), `sourceMapEmbed` (old API), and `sourceMapRoot` (old API) options because `sass-loader` sets these automatically when the `sourceMap` option is `true`.
|
|
306
306
|
|
|
307
307
|
> [!NOTE]
|
|
308
308
|
>
|
|
@@ -313,7 +313,9 @@ There is a slight difference between the options for `sass` (`dart-sass`) and `n
|
|
|
313
313
|
Please consult their respective documentation before using them:
|
|
314
314
|
|
|
315
315
|
- [Dart Sass documentation](https://sass-lang.com/documentation/js-api/interfaces/Options) for all available `sass` options.
|
|
316
|
+
- [Sass Embedded documentation](https://github.com/sass/embedded-host-node) for all available `sass` options.
|
|
316
317
|
- [Node Sass documentation](https://github.com/sass/node-sass/#options) for all available `node-sass` options.
|
|
318
|
+
- [Sass Embedded documentation](https://github.com/sass/embedded-host-node) for all available `sass` options.
|
|
317
319
|
|
|
318
320
|
#### `object`
|
|
319
321
|
|
|
@@ -334,8 +336,8 @@ module.exports = {
|
|
|
334
336
|
loader: "sass-loader",
|
|
335
337
|
options: {
|
|
336
338
|
sassOptions: {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
+
style: `compressed`,
|
|
340
|
+
loadPaths: ["absolute/path/a", "absolute/path/b"],
|
|
339
341
|
},
|
|
340
342
|
},
|
|
341
343
|
},
|
|
@@ -369,12 +371,12 @@ module.exports = {
|
|
|
369
371
|
|
|
370
372
|
if (relativePath === "styles/foo.scss") {
|
|
371
373
|
return {
|
|
372
|
-
|
|
374
|
+
loadPaths: ["absolute/path/c", "absolute/path/d"],
|
|
373
375
|
};
|
|
374
376
|
}
|
|
375
377
|
|
|
376
378
|
return {
|
|
377
|
-
|
|
379
|
+
loadPaths: ["absolute/path/a", "absolute/path/b"],
|
|
378
380
|
};
|
|
379
381
|
},
|
|
380
382
|
},
|
|
@@ -401,7 +403,7 @@ Enables/Disables generation of source maps.
|
|
|
401
403
|
By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
|
|
402
404
|
All values enable source map generation except `eval` and `false`.
|
|
403
405
|
|
|
404
|
-
> ℹ If `true`, the `sourceMap
|
|
406
|
+
> ℹ If `true`, the `sourceMap` (new API, by default since 16 version), `outFile` (old API), `sourceMapContents` (old API), `sourceMapEmbed` (old API), and `sourceMapRoot` (old API) from `sassOptions` will be ignored.
|
|
405
407
|
|
|
406
408
|
**webpack.config.js**
|
|
407
409
|
|
|
@@ -683,7 +685,7 @@ Type:
|
|
|
683
685
|
type api = "legacy" | "modern" | "modern-compiler";
|
|
684
686
|
```
|
|
685
687
|
|
|
686
|
-
Default: `"modern"` for `sass` (`dart-sass`) and `sass-embedded
|
|
688
|
+
Default: `"modern"` for `sass` (`dart-sass`) and `sass-embedded`, or `"legacy"` for `node-sass`
|
|
687
689
|
|
|
688
690
|
Allows you to switch between the `legacy` and `modern` APIs. You can find more information [here](https://sass-lang.com/documentation/js-api). The `modern-compiler` option enables the modern API with support for [Shared Resources](https://github.com/sass/sass/blob/main/accepted/shared-resources.d.ts.md).
|
|
689
691
|
|
package/dist/utils.js
CHANGED
|
@@ -599,6 +599,8 @@ function getCompileFn(loaderContext, implementation, apiType) {
|
|
|
599
599
|
webpackCompiler.hooks.shutdown.tap("sass-loader", () => {
|
|
600
600
|
compiler.dispose();
|
|
601
601
|
});
|
|
602
|
+
} else {
|
|
603
|
+
compiler.dispose();
|
|
602
604
|
}
|
|
603
605
|
}
|
|
604
606
|
return sassModernCompilers.get(webpackCompiler).compileStringAsync(data, rest);
|
|
@@ -691,16 +693,15 @@ function normalizeSourceMap(map, rootContext) {
|
|
|
691
693
|
function errorFactory(error) {
|
|
692
694
|
let message;
|
|
693
695
|
if (error.formatted) {
|
|
694
|
-
message = error.formatted.replace(/^Error: /, "");
|
|
696
|
+
message = error.formatted.replace(/^(.+)?Error: /, "");
|
|
695
697
|
} else {
|
|
696
698
|
// Keep original error if `sassError.formatted` is unavailable
|
|
697
|
-
(
|
|
698
|
-
message
|
|
699
|
-
} = error);
|
|
699
|
+
message = (error.message || error.toString()).replace(/^(.+)?Error: /, "");
|
|
700
700
|
}
|
|
701
701
|
const obj = new Error(message, {
|
|
702
702
|
cause: error
|
|
703
703
|
});
|
|
704
|
+
obj.name = error.name;
|
|
704
705
|
obj.stack = null;
|
|
705
706
|
return obj;
|
|
706
707
|
}
|