You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**[`implementation`](#implementation)**|`{Object}`|`sass`| Setup Sass implementation to use. |
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. |
128
128
|**[`webpackImporter`](#webpackimporter)**|`{Boolean}`|`true`| Enables/Disables the default Webpack importer. |
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.
Copy file name to clipboardExpand all lines: src/options.json
+8-1
Original file line number
Diff line number
Diff line change
@@ -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
-
"type": "object"
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).",
0 commit comments