You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<scriptlang="ts">
// Do not inline the SVG. Use the href value in the CSS.importbackgroundfrom'$lib/static/background.svg?url';
</script>
<divstyle:background-image={`url("${background}")`}></div>
Alternative
The new URL(url, import.meta.url) method exists, but it does not work in SSR.
This pattern does not work if you are using Vite for Server-Side Rendering, because import.meta.url have different semantics in browsers vs. Node.js.
Description
Allow individual static asset imports to opt-out from inlining.
The following SVG file is inlined in the build process.
Currently, asset inline can only be disabled globally.
Suggested solution
Utilize the explicit URL import syntax.
Alternative
The
new URL(url, import.meta.url)
method exists, but it does not work in SSR.https://vitejs.dev/guide/assets.html#new-url-url-import-meta-url
Additional context
Related issue and PR:
SvelteKit context:
/static
directory.https://github.com/sveltejs/kit/blob/511126b51d4aaa770704491ff0890a76fa116205/packages/adapter-node/src/handler.js#L54-L56
Validations
The text was updated successfully, but these errors were encountered: