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

preserveModules, but keep and entry point with @import #248

Open
fregante opened this issue Aug 19, 2024 · 0 comments
Open

preserveModules, but keep and entry point with @import #248

fregante opened this issue Aug 19, 2024 · 0 comments

Comments

@fregante
Copy link

I'm trying to use preserveModules: true primarily for JS code, but this has a confusing output for CSS files.

Input

/* main.js */
import './alpha.css';
import './beta.css';
console.log('hi')
/* alpha.css */
html {color: red;}
/* beta.css */
body {font-weight: bold}

Current output

/* main.js */
console.log('hi')
/* main.css */
html {color: red;}
body {font-weight: bold}
/* alpha.css */
html {color: red;}
/* beta.css */
body {font-weight: bold}

Expected output

One of:

  • only main.css (ignoring preserveModule, which I don't need for CSS)
  • alpha.css, beta.css, and a main.css that looks like @import 'alpha.css';@import 'beta.css'

Final notes

I'm mostly ok with the current behavior as the duplicate CSS is minor and inert, but I'm afraid that this is considered a "bug" and it might be "fixed" in a way that doesn't match my expectations (i.e. main.css is no longer created or it's empty, without imports)

Related

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

No branches or pull requests

1 participant