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

Broken CSS Modules when code splitting enabled #18244

Open
gwer opened this issue Mar 17, 2025 · 0 comments
Open

Broken CSS Modules when code splitting enabled #18244

gwer opened this issue Mar 17, 2025 · 0 comments
Labels
bug Something isn't working bundler Something to do with the bundler css CSS parser, bundler-related

Comments

@gwer
Copy link

gwer commented Mar 17, 2025

What version of Bun is running?

1.2.5+013fdddc6

What platform is your computer?

Linux 6.11.10-300.fc41.x86_64 x86_64

What steps can reproduce the bug?

To reproduce the bug you need to build at least two entrypoints, imported CSS Modules and enabled code splitting.

styles.module.css:

.wrapper {
  display: block;
}

index.ts, index2.ts (they may have the same content):

import styles from './styles.module.css';

console.log(styles);

The build command:

bun build ./index.ts ./index2.ts --outdir ./out --splitting

What is the expected behavior?

Expected output is something like this:

// styles.module.css
var styles_module_default = {
  wrapper: "wrapper_-MSaAA"
};

// index.ts
console.log(styles_module_default);

What do you see instead?

Both entrypoints are build as follows:

// index.ts
console.log(styles_module_default);

The definition of styles_module_default is missing.

Additional information

If there is only one entrypoint or code splitting is disabled, everything works correctly.

@gwer gwer added bug Something isn't working needs triage labels Mar 17, 2025
@RiskyMH RiskyMH added bundler Something to do with the bundler css CSS parser, bundler-related and removed needs triage labels Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bundler Something to do with the bundler css CSS parser, bundler-related
Projects
None yet
Development

No branches or pull requests

2 participants