Replies: 2 comments
-
Maybe you can refer to vite-plugin-raw-assets to implement a |
Beta Was this translation helpful? Give feedback.
0 replies
-
@chenxch thanks for the plugin reference. It solves the issue with the inability to use My idea was to have the logic behind |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Idea description
I wonder whether we could have the ability to enforce base64 URL encoding of assets by passing
?inline
query parameter (as an out-of-the-box feature). Currently, assets are being inlined only automatically, based on theassetsInlineLimit
option.Use case
Being able to import, in a predictable way, base64-encoded images for libraries which expect them in such a format, e.g. pdf generating utilities.
Webpack configuration
With Webpack, it could be easily achieved by configuring a rule for assets, matching the
/inline/
resource query with theasset/inline
type.Possible implementation
Probably only
asset
plugin would be affected. We could extract the logic behind base64 conversion fromfileToBuiltUrl
, and re-use it in theload
function with an early return. It would be similar to the?raw
requests, so?inline
enforcement would be handled equally for bothserve
andbuild
.Beta Was this translation helpful? Give feedback.
All reactions