jpkleemans/vite-svg-loader

Is it possible to import icons from an S3 in production ?

Closed this issue · 1 comments

Hello !

At work, we have a workflow where SVGs are automatically optimized and put on an S3 service to be directly distributed and avoid a HIT on our servers.

I was wondering if it was possible (or conceivable) that during the production build, it loads the icons from an S3 server.
For example, we have a manifest.json file that contains all the imports and their chunked matches, we could on the fly point to S3 directly.

I mean, I know it's a bit peculiar but it would be cool if there was a way to do that
Kind regards

Hi, thanks for your question. I'm not sure if there's a possibility to import remote files in Vite. You could try it by using a full url with the import function: await import('http://example.com/my-icon.svg').
If that doesn't work, I think you should take this question to the Vite team, since vite-svg-loader uses Vite's loading pipeline when loading svg files.