Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary .svg files in build dist #35

Open
chojnicki opened this issue Mar 5, 2021 · 0 comments
Open

Unnecessary .svg files in build dist #35

chojnicki opened this issue Mar 5, 2021 · 0 comments

Comments

@chojnicki
Copy link

After build all .svg that was imported as component are also present in dist folder. Since svg are in .js they are just waste of space. After deleting them manually of course site works just fine.

I noticed that similar package https://github.com/jpkleemans/vite-svg-loader (without support to SVGO and url svg) does not have this issue (svg files are not present in dist). I messed up in sources of both and in this package (vite-plugin-vue-svg) I can see that it is using transform() hook and vite-svg-loader is using load().

So if we just replace transform with load it works for ?component, but not for ?url since no .svg are saved.

U guess it could be fixed like this:

async transform(source, id, isBuild) {
  // for ?url svg
},
async load(id) {
  // for ?component svg
}

Also enforce: 'pre' will be required.

Maybe it can be fixed in other way.

What do You @visualfanatic think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant