Skip to content

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

Open
@drewbaker

Description

@drewbaker

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 }]
                        }
                    }
                }
            ]
        })
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions