feat(asset): inline svg in dev if within limit#18581
Conversation
patak-cat
left a comment
There was a problem hiding this comment.
I think it would be good in the future to move the build.assetsInlineLimit to root (where we also have now assetsInclude). But it sounds good to me to move forward with the PR as is, and do this later on.
I think maybe we could have top-level { assets: { include, inlineLimit }
I'm not too sure if we need to go there yet since that could imply the inlining will consistently happen in dev too, but we're currently only doing it for SVGs. But definitely something to watch for though if we're using more build options in dev. |
Description
close #18034
As discussed before, due to quote handling difference between SVG url paths and inlined SVG data url, we decided to align the inlined behaviour from build to dev so that users don't get broken SVGs after deploying.
This PR adds the code to do the inline checks in dev for SVG assets. The downside I guess is that we're relying on build config in dev, which we usually try to avoid, but we may have to make an exception here.
NOTES:
?inlineand?no-inlinequeries to control inlining #15454) are incorrectly injected with?t=for HMR invalidation. Since data URLs are the entire content itself, we don't need to inject it for them.shouldInlinea bit so that:.htmland.svgchecks are done earlierbuildPluginContextparameter