-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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_element
function is output even if no svg element in a component
#6555
Comments
In response to #6556 comments, I've thought of several implementations to fix #6555, but each has its trade-offs.
To clarify the trade-offs of these implementations, I compiled the following components in each implementation and compared the bundle sizes.
The sources and artifacts used for the comparison can be found in this repository. ResultsSmall-size componentsComponent
Note: The sizes for gzip and brotli are for reference only. Middle-size componentsComponent
Note: The sizes for gzip and brotli are for reference only. Comparison of implementationsv3.40.0 and impl1In almost all cases, the bundle size of impl1 is smaller than that of v3.40.0. There is no doubt that impl1 is better. impl2 and impl3This depends on the use case. If the number of elements is small, the bundle size of impl2 will be small, but if the number of elements is large, the bundle size of impl3 will be smaller. impl1 and impl3This also depends on the use case.In many cases, impl3 can reduce the bundle size, but if you use svg-elements and not-svg-elements to create components with only a few elements, the larger footprint of impl3 will be noticeable. However, if the component is to be used in a Svelte application, impl3 is a better choice. I think that use case is more common. Based on these, I am going to submit a PR with impl3. I would appreciate your opinion. Sorry for my English. |
This should be fixed in 3.42.2 - the |
Describe the problem
when
hydratable: true
,svg_element
function is output even if no svg element in a component.For example, if you have a simple component like the following:
compiled:
minified(formatted):
This isn't a bug (because it works fine), but it does increase the bundle size slightly.
Describe the proposed solution
Pass
svg_element
function, instead of1
.Alternatives considered
Also,
element
function is output even if the component has only svg elements.If it is important to improve that as well, more changes are needed.
Importance
nice to have
The text was updated successfully, but these errors were encountered: