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

Can't opt out of creating bundle for imported CSS #2753

Closed
gusso opened this issue Dec 16, 2022 · 0 comments
Closed

Can't opt out of creating bundle for imported CSS #2753

gusso opened this issue Dec 16, 2022 · 0 comments

Comments

@gusso
Copy link

gusso commented Dec 16, 2022

When JavaScript files import any CSS, a .css bundle is created next to the .js output. I don't want that file to be created on one of my builds, is there a way to opt out of creating a bundle for a given extension?

I expected to be able to do that from the loader property, maybe by setting the value for an extension to none.

In the meantime, I'm setting the extension to text and then silencing the warning that comes from importing a text file. Is this the best approach for now?

build({
  entryPoints: [`src/bundles/browser.jsx`],
  outfile: `build/browser.js`,

  // ignore CSS output
  loader: { ".css": "text" },
  logOverride: { "ignored-bare-import": "silent" },
})
@gusso gusso changed the title Can't opt out of imported CSS Can't opt out of creating bundle for imported CSS Dec 16, 2022
@evanw evanw closed this as completed in aee4010 Dec 16, 2022
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