jpkleemans / vite-svg-loader

Vite plugin to load SVG files as Vue components
MIT License
555 stars 59 forks source link

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

Closed SirMishaa closed 1 year ago

SirMishaa commented 1 year ago

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

jpkleemans commented 1 year ago

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.