File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -876,6 +876,21 @@ export default defineConfig({
876876 } ,
877877
878878 build : {
879+ // Never inline assets as `data:` URLs. Output's `StripCSSImport`
880+ // transform rewrites `import "./foo.css"` to
881+ // `_LOAD_CSS_WORKER(new URL("./foo.css", import.meta.url).pathname)`.
882+ // Vite recognises the `new URL(literal, import.meta.url)` pattern
883+ // and, by default, inlines small assets as
884+ // `data:text/css;base64,...` URLs. The runtime call
885+ // `new URL("data:text/css;...", base).pathname` then strips the
886+ // `data:` scheme and yields a bare `text/css;base64,...` string,
887+ // which `_LOAD_CSS_WORKER` tries to fetch as a path and the
888+ // browser 404s with `non CSS MIME types are not allowed in
889+ // strict mode`. Setting `assetsInlineLimit: 0` forces every
890+ // referenced CSS asset to emit as a hashed file under `_astro/`
891+ // where the runtime worker can fetch it the same way it does
892+ // for larger CSS chunks.
893+ assetsInlineLimit : 0 ,
879894 rollupOptions : {
880895 // Bundled-workbench Rollup inputs. When `Pack`
881896 // is empty this map is empty and Astro's auto-generated page
You can’t perform that action at this time.
0 commit comments