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

SVG components should be included in the main bundle #41

Closed
palle-k opened this issue Jun 23, 2022 · 2 comments
Closed

SVG components should be included in the main bundle #41

palle-k opened this issue Jun 23, 2022 · 2 comments

Comments

@palle-k
Copy link

palle-k commented Jun 23, 2022

When creating a production build, this plugin will emit SVG components as separate files instead of having them be included in the main bundle.

Example: I have an icon foo.svg in my project. When I create a production build, the output bundle will contain the file foo.hash.js

However, I would prefer that the contents of foo.hash.js file were to be included in the index.hash.js file, so that not all SVG components need to be loaded separately.

Also: SVG files are still included in the bundle as well.

Config:

svgr({
  exportAsDefault: true
}),
@pd4d10
Copy link
Owner

pd4d10 commented Jun 24, 2022

Could you please provide a reproduction? It looks like not due to this plugin, but probably something like dynamic import

@palle-k
Copy link
Author

palle-k commented Jun 24, 2022

Looks like this was due to me using import.meta.glob instead of globEager to import SVG components. Issue is resolved.

@palle-k palle-k closed this as completed Jun 24, 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

2 participants