sass-loader 12.0.0 → 12.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 +31 -2
- package/dist/options.json +8 -1
- package/dist/utils.js +11 -0
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ Thankfully there are a two solutions to this problem:
|
|
|
121
121
|
|
|
122
122
|
| Name | Type | Default | Description |
|
|
123
123
|
| :---------------------------------------: | :------------------: | :-------------------------------------: | :---------------------------------------------------------------- |
|
|
124
|
-
| **[`implementation`](#implementation)** |
|
|
124
|
+
| **[`implementation`](#implementation)** | `{Object\|String}` | `sass` | Setup Sass implementation to use. |
|
|
125
125
|
| **[`sassOptions`](#sassoptions)** | `{Object\|Function}` | defaults values for Sass implementation | Options for Sass. |
|
|
126
126
|
| **[`sourceMap`](#sourcemap)** | `{Boolean}` | `compiler.devtool` | Enables/Disables generation of source maps. |
|
|
127
127
|
| **[`additionalData`](#additionaldata)** | `{String\|Function}` | `undefined` | Prepends/Appends `Sass`/`SCSS` code before the actual entry file. |
|
|
@@ -129,7 +129,7 @@ Thankfully there are a two solutions to this problem:
|
|
|
129
129
|
|
|
130
130
|
### `implementation`
|
|
131
131
|
|
|
132
|
-
Type: `Object`
|
|
132
|
+
Type: `Object | String`
|
|
133
133
|
Default: `sass`
|
|
134
134
|
|
|
135
135
|
The special `implementation` option determines which implementation of Sass to use.
|
|
@@ -168,6 +168,8 @@ In order to avoid this situation you can use the `implementation` option.
|
|
|
168
168
|
|
|
169
169
|
The `implementation` options either accepts `sass` (`Dart Sass`) or `node-sass` as a module.
|
|
170
170
|
|
|
171
|
+
#### Object
|
|
172
|
+
|
|
171
173
|
For example, to use Dart Sass, you'd pass:
|
|
172
174
|
|
|
173
175
|
```js
|
|
@@ -193,6 +195,33 @@ module.exports = {
|
|
|
193
195
|
};
|
|
194
196
|
```
|
|
195
197
|
|
|
198
|
+
#### String
|
|
199
|
+
|
|
200
|
+
For example, to use Dart Sass, you'd pass:
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
module.exports = {
|
|
204
|
+
module: {
|
|
205
|
+
rules: [
|
|
206
|
+
{
|
|
207
|
+
test: /\.s[ac]ss$/i,
|
|
208
|
+
use: [
|
|
209
|
+
"style-loader",
|
|
210
|
+
"css-loader",
|
|
211
|
+
{
|
|
212
|
+
loader: "sass-loader",
|
|
213
|
+
options: {
|
|
214
|
+
// Prefer `dart-sass`
|
|
215
|
+
implementation: require.resolve("sass"),
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
```
|
|
224
|
+
|
|
196
225
|
Note that when using `sass` (`Dart Sass`), **synchronous compilation is twice as fast as asynchronous compilation** by default, due to the overhead of asynchronous callbacks.
|
|
197
226
|
To avoid this overhead, you can use the [fibers](https://www.npmjs.com/package/fibers) package to call asynchronous importers from the synchronous code path.
|
|
198
227
|
|
package/dist/options.json
CHANGED
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
"properties": {
|
|
5
5
|
"implementation": {
|
|
6
6
|
"description": "The implementation of the sass to be used (https://github.com/webpack-contrib/sass-loader#implementation).",
|
|
7
|
-
"
|
|
7
|
+
"anyOf": [
|
|
8
|
+
{
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "object"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
8
15
|
},
|
|
9
16
|
"sassOptions": {
|
|
10
17
|
"description": "Options for `node-sass` or `sass` (`Dart Sass`) implementation. (https://github.com/webpack-contrib/sass-loader#implementation).",
|
package/dist/utils.js
CHANGED
|
@@ -56,6 +56,17 @@ function getSassImplementation(loaderContext, implementation) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
if (typeof resolvedImplementation === "string") {
|
|
60
|
+
try {
|
|
61
|
+
// eslint-disable-next-line import/no-dynamic-require, global-require
|
|
62
|
+
resolvedImplementation = require(resolvedImplementation);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
loaderContext.emitError(error); // eslint-disable-next-line consistent-return
|
|
65
|
+
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
59
70
|
const {
|
|
60
71
|
info
|
|
61
72
|
} = resolvedImplementation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sass-loader",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "Sass loader for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/sass-loader",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"prebuild": "npm run clean",
|
|
22
22
|
"build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
|
23
23
|
"commitlint": "commitlint --from=master",
|
|
24
|
-
"security": "npm audit",
|
|
24
|
+
"security": "npm audit --production",
|
|
25
25
|
"lint:prettier": "prettier --list-different .",
|
|
26
26
|
"lint:js": "eslint --cache .",
|
|
27
27
|
"lint": "npm-run-all -l -p \"lint:**\"",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"neo-async": "^2.6.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/cli": "^7.14.
|
|
63
|
-
"@babel/core": "^7.14.
|
|
64
|
-
"@babel/preset-env": "^7.14.
|
|
62
|
+
"@babel/cli": "^7.14.5",
|
|
63
|
+
"@babel/core": "^7.14.5",
|
|
64
|
+
"@babel/preset-env": "^7.14.5",
|
|
65
65
|
"@commitlint/cli": "^12.1.4",
|
|
66
66
|
"@commitlint/config-conventional": "^12.1.4",
|
|
67
67
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
68
|
-
"babel-jest": "^27.0.
|
|
68
|
+
"babel-jest": "^27.0.2",
|
|
69
69
|
"bootstrap-sass": "^3.4.1",
|
|
70
70
|
"bootstrap-v4": "npm:bootstrap@^4.5.3",
|
|
71
71
|
"bootstrap-v5": "npm:bootstrap@^5.0.1",
|
|
@@ -74,26 +74,26 @@
|
|
|
74
74
|
"del": "^6.0.0",
|
|
75
75
|
"del-cli": "^3.0.1",
|
|
76
76
|
"enhanced-resolve": "^5.8.2",
|
|
77
|
-
"eslint": "^7.
|
|
77
|
+
"eslint": "^7.28.0",
|
|
78
78
|
"eslint-config-prettier": "^8.3.0",
|
|
79
79
|
"eslint-plugin-import": "^2.23.3",
|
|
80
80
|
"fibers": "^5.0.0",
|
|
81
81
|
"file-loader": "^6.2.0",
|
|
82
82
|
"foundation-sites": "^6.6.3",
|
|
83
83
|
"husky": "^6.0.0",
|
|
84
|
-
"jest": "^27.0.
|
|
84
|
+
"jest": "^27.0.4",
|
|
85
85
|
"lint-staged": "^11.0.0",
|
|
86
86
|
"material-components-web": "^8.0.0",
|
|
87
87
|
"memfs": "^3.2.2",
|
|
88
88
|
"node-sass": "^6.0.0",
|
|
89
89
|
"node-sass-glob-importer": "^5.3.2",
|
|
90
90
|
"npm-run-all": "^4.1.5",
|
|
91
|
-
"prettier": "^2.3.
|
|
92
|
-
"sass": "^1.34.
|
|
91
|
+
"prettier": "^2.3.1",
|
|
92
|
+
"sass": "^1.34.1",
|
|
93
93
|
"semver": "^7.3.5",
|
|
94
94
|
"standard-version": "^9.3.0",
|
|
95
95
|
"style-loader": "^2.0.0",
|
|
96
|
-
"webpack": "^5.
|
|
96
|
+
"webpack": "^5.38.1"
|
|
97
97
|
},
|
|
98
98
|
"keywords": [
|
|
99
99
|
"sass",
|