Skip to content

Document webpack change: feat(css): allow to use default and named export #7222

Closed
@webpack-bot

Description

@webpack-bot

A pull request by @alexander-akait was merged and maintainers requested a documentation change.

See pull request: webpack/webpack#18271


What kind of change does this PR introduce?

feature - allow to use default and named export

The same as requested here - webpack-contrib/mini-css-extract-plugin#1084

/cc @ahabhgk What do you think about it?

The main idea - allow to easy migrate from default to named, by default it is disabled (because we use only named export), but if developers have a lot of code, it is not easy to migrate fast, so developer can disable named export and use both of them

Did you add tests for your changes?

Yes

Does this PR introduce a breaking change?

No

What needs to be documented once your changes are merged?

When named export is disabled for CSS modules you can get classes using (we redirect named export for better DX, it will allow to migrate from default export to named smoothly):

import * as styles from "./styles.css";
import styles1 from "./styles.css";
import { foo } from "./styles.css";

console.log(styles.default.foo);
console.log(styles.foo);
console.log(styles1.foo);
console.log(foo);

When namedExport: true, you can use only named export.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions