nuxt-community / svg-module

Super simple svg loading module for Nuxt.js
MIT License
340 stars 35 forks source link

How to use dynamic imports with Vite? #93

Closed retroriff closed 2 years ago

retroriff commented 2 years ago

On Vite require doesn't work because it's webpack-only.

<template>
  <div v-html="require(`../assets/${name}.svg?raw`)" />
</template>

<script>
  export default {
    props: {
      name: { type: String, default: "image" },
    },
  };
</script>

Is there any alternative for Vite?

manuelodelain commented 2 years ago

Duplicate of #86