-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I'm using this plugin in a AspNetCore environment. I need the actual file and not have it injected.
I want to reference the generated file in a partial
<svg>
<use href="@Url.Content(string.Format("~/assets/svg-symbols.svg#{0}", @Model))"></use>
</svg>
When running vite build, it is stored in "\wwwroot\assets\svg-symbols.svg", which is what you would expect.
However, in dev mode, the svg-symbols file is not available via this path, nor other tries (eg. "~/svg-symbols.svg").
This is my vite config, fairly straight forwarded. Should I not be able to access this in dev mode? Also injecting it doesn't seem to do anything. I don't do anything in main.ts.
import svgSpritePlugin from '@pivanov/vite-plugin-svg-sprite;
export default defineConfig({
build: {
manifest: true,
outDir: 'wwwroot',
rollupOptions: {
input: {
main: './main.ts',
},
},
},
server: {
port: 5173,
},
plugins: [
svgSpritePlugin({
iconDirs: ["./Assets/Icons"],
symbolId: "[name]",
svgDomId: 'svg-symbols',
fileName: 'svg-symbols.svg',
})
],
});
I'm using Vite.AspNetCore, which generates this in the header. But this works fine for my other assets.
<script type="module" src="http://localhost:5173/@vite/client"></script>
<script src="http://localhost:5173/main.ts" type="module"></script>
Metadata
Metadata
Assignees
Labels
No labels