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
|**[`modules`](#modules)**|`{Boolean\|String\|Object}`|`{auto: true}`| Enables/Disables CSS Modules and their configuration |
115
115
|**[`sourceMap`](#sourcemap)**|`{Boolean}`|`compiler.devtool`| Enables/Disables generation of source maps |
116
116
|**[`importLoaders`](#importloaders)**|`{Number}`|`0`| Enables/Disables or setups number of loaders applied before CSS loader |
117
117
|**[`esModule`](#esmodule)**|`{Boolean}`|`true`| Use ES modules syntax |
118
118
119
119
### `url`
120
120
121
-
Type: `Boolean|Function`
121
+
Type: `Boolean|Object`
122
122
Default: `true`
123
123
124
124
Enables/Disables handling the CSS functions `url` and `image-set`. If set to `false`, `css-loader` will not parse any paths specified in `url` or `image-set`. A function can also be passed to control this behavior dynamically based on the path to the asset. Starting with version [4.0.0](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#400-2020-07-25), absolute paths are parsed based on the server root.
@@ -164,7 +164,7 @@ module.exports = {
164
164
};
165
165
```
166
166
167
-
#### `Function`
167
+
#### `Object`
168
168
169
169
Allow to filter `url()`. All filtered `url()` will not be resolved (left in the code as they were written).
170
170
@@ -178,15 +178,17 @@ module.exports = {
178
178
test:/\.css$/i,
179
179
loader:"css-loader",
180
180
options: {
181
-
url: (url, resourcePath) => {
182
-
// resourcePath - path to css file
181
+
url: {
182
+
filter: (url, resourcePath) => {
183
+
// resourcePath - path to css file
183
184
184
-
// Don't handle `img.png` urls
185
-
if (url.includes("img.png")) {
186
-
returnfalse;
187
-
}
185
+
// Don't handle `img.png` urls
186
+
if (url.includes("img.png")) {
187
+
returnfalse;
188
+
}
188
189
189
-
returntrue;
190
+
returntrue;
191
+
},
190
192
},
191
193
},
192
194
},
@@ -197,7 +199,7 @@ module.exports = {
197
199
198
200
### `import`
199
201
200
-
Type: `Boolean|Function`
202
+
Type: `Boolean|Object`
201
203
Default: `true`
202
204
203
205
Enables/Disables `@import` at-rules handling.
@@ -245,7 +247,7 @@ module.exports = {
245
247
};
246
248
```
247
249
248
-
#### `Function`
250
+
#### `Object`
249
251
250
252
Allow to filter `@import`. All filtered `@import` will not be resolved (left in the code as they were written).
0 commit comments