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

Use with webpack loaders (for SVG's as component) #69

Open
drewbaker opened this issue Jul 3, 2020 · 2 comments
Open

Use with webpack loaders (for SVG's as component) #69

drewbaker opened this issue Jul 3, 2020 · 2 comments

Comments

@drewbaker
Copy link

drewbaker commented Jul 3, 2020

It would be great if this supported your defined custom webpack loaders, so we could use SVG's as components and have them auto imported.

I wish we could do this:

// In template
<template>
    <svg-logo/>
</template>
// nuxt.config.js
components: [
    { path: "~/components", extensions: ["vue"] },
    { path: "~/assets/svgs/", prefix: "svg", extensions: ["svg"] }
],
build: {
    extend(config, { isDev, isClient }) {
        // Add SVG loader
        config.module.rules.push({
            test: /\.svg$/,
            use: [
                "babel-loader",
                {
                    loader: "vue-svg-loader",
                    options: {
                        svgo: {
                            plugins: [{ removeViewBox: false }]
                        }
                    }
                }
            ]
        })
    }
@MentalGear
Copy link

Can svgs currently be dynamically / lazy loaded through components ?

@drewbaker
Copy link
Author

@pi0 any tips how how we can or should be using this with SVGs (as Vue components with a loader?)

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

2 participants