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
Copy file name to clipboardExpand all lines: src/content/configuration/module.mdx
+61-2Lines changed: 61 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,6 +262,9 @@ module.exports = {
262
262
css: {
263
263
// Parser options for css modules
264
264
265
+
// Enable/disable `@import` at-rules handling, available since webpack 5.97.0
266
+
// type: boolean
267
+
import:true,
265
268
// Use ES modules named export for css exports, available since webpack 5.90.0
266
269
// type: boolean
267
270
namedExports:true,
@@ -281,9 +284,65 @@ module.exports = {
281
284
};
282
285
```
283
286
284
-
### module.parser.css.namedExports
287
+
### module.parser.css
288
+
289
+
Configure options for the CSS parser.
290
+
291
+
```js
292
+
module.exports= {
293
+
module: {
294
+
parser: {
295
+
css: {
296
+
// ...
297
+
namedExports:true,
298
+
},
299
+
},
300
+
},
301
+
};
302
+
```
303
+
304
+
#### module.parser.css.import
305
+
306
+
This option enables the handling of `@import` at-rules in CSS files. When set to `true`, `@import` statements are processed, allowing modular inclusion of styles from other CSS files.
307
+
308
+
- Type: `boolean`
309
+
- Available: 5.97.0+
310
+
- Example:
311
+
312
+
```js
313
+
module.exports= {
314
+
module: {
315
+
parser: {
316
+
css: {
317
+
import:true,
318
+
},
319
+
},
320
+
},
321
+
};
322
+
```
323
+
324
+
```css
325
+
/* reset-styles.css */
326
+
body {
327
+
margin: 0;
328
+
padding: 0;
329
+
}
330
+
```
331
+
332
+
```css
333
+
/* styles.css */
334
+
@import'./reset-styles.css';
335
+
336
+
body {
337
+
background-color: red;
338
+
}
339
+
```
340
+
341
+
T> Filtering of `@import` rules, as [supported by css-loader](/loaders/css-loader/#filter), is not supported in the parser.
342
+
343
+
#### module.parser.css.namedExports
285
344
286
-
This option enables the use of ES modules named export for CSS exports. When set to true, the CSS module will export its classes and styles using named exports.
345
+
This option enables the use of ES modules named export for CSS exports. When set to `true`, the CSS module will export its classes and styles using named exports.
0 commit comments