You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a reason with assets are forced to be inlined when build.lib is configured?
I'm currently developing a React component library and 99% of assets are simple svg icons so inlining them seems ok but I got a component that imports a (relative big) JPG image. It is a component that is going to be rendered only under specific circumstances so inlining the converted base64 string doesn't make much sense for the rest of the code, and also the fact the base64 is not an "optimized" format and the final transform is actually bigger than the actual file:
original file size: 50 KB
inline base64 string: 67.53 KB
I know this example is just a few KB of difference but the more inline assets the bigger (and noisy) the build will be.
Could be there an option to force an asset to be always external? like import assetUrl from './asset.xx?no-inline'?
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
Describe the bug
Is there a reason with assets are forced to be inlined when
build.lib
is configured?I'm currently developing a React component library and 99% of assets are simple svg icons so inlining them seems ok but I got a component that imports a (relative big) JPG image. It is a component that is going to be rendered only under specific circumstances so inlining the converted base64 string doesn't make much sense for the rest of the code, and also the fact the base64 is not an "optimized" format and the final transform is actually bigger than the actual file:
original file size: 50 KB
inline base64 string: 67.53 KB
I know this example is just a few KB of difference but the more inline assets the bigger (and noisy) the build will be.
Could be there an option to force an asset to be always external? like
import assetUrl from './asset.xx?no-inline'
?Reproduction
https://stackblitz.com/edit/vitejs-vite-z4eivh?file=main.js&terminal=dev
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: