Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
webpack-bot opened this issue Apr 2, 2024 · 0 comments · Fixed by #7274
Closed

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

webpack-bot opened this issue Apr 2, 2024 · 0 comments · Fixed by #7274
Assignees

Comments

@webpack-bot
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants