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

Rollup breaks CSS imports for non-entrypoint modules #192

Closed
simonihmig opened this issue Sep 3, 2023 · 1 comment · Fixed by embroider-build/embroider#1600
Closed

Comments

@simonihmig
Copy link
Collaborator

When you have a component that

  • imports CSS, like import './foo.css';
  • and is not an entrypoint to rollup (like a private component in src/-private/foo.gjs that is imported and used internally)

then rollup would

  • move that component module around (component is in /dist/foo-<randomnumbers>.js)
  • leave the CSS in place (/dist/-private/foo.css)
  • and not rewrite the import (still import './foo.css';)

so webpack (in the consuming app) would expectedly throw an error.

It can be worked around by making all modules entrypoints (like addon.publicEntrypoints(['**/*.js'])). Addons could still limit the public/importable modules through package.json#exports.

Not sure if that's something we should move to?

@ef4
Copy link
Contributor

ef4 commented Sep 4, 2023

Not sure if that's something we should move to?

No, we should not make every module an entrypoint.

This is a bug in @embroider/addon-dev's keepAssets.

simonihmig added a commit to embroider-build/embroider that referenced this issue Sep 13, 2023
When modules reference static assets added to the build via the `keepAssets` rollup plugin, and those modules are not entrypoints and as such moved into a bundle at a different location, the relative path to that asset would not get rewritten, leading to broken references.

Fixes embroider-build/addon-blueprint#192
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