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
Failed to load module script: The server responded with a non-JavaScript MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec.
And during build with error:
TypeError: Cannot read property 'imports' of undefined
at getPreloadLinksForChunk ({path}\node_modules\vite\dist\node\chunks\dep-85227760.js:36877:36)
at {path}\node_modules\vite\dist\node\chunks\dep-85227760.js:36885:34
at Array.forEach ()
at getPreloadLinksForChunk ({path}\node_modules\vite\dist\node\chunks\dep-85227760.js:36884:31)
at Object.generateBundle ({path}i\node_modules\vite\dist\node\chunks\dep-85227760.js:36928:28)
at {path}\node_modules\rollup\dist\shared\rollup.js:18781:25
Vite won't rewrite the URL and the import doesn't even hit the dev server during dev. This probably currently fails during build, which we should provide built-in support for.
And for the JSON case - since you actually can't natively import json from data URIs, it fails. Although I'm not quite sure in what case would this actually be useful when you can simply import from an actual JSON file...
If we were to make json data-uri imports work, we'd have to rewrite all data URIs to a special, valid path that would hit the dev server (e.g. /@data-uri/xxxx), and then decode, transform, and send it back.
Ok, so js data-uri imports were previously excluded from build which works natively, but is sub-optimal and would break in the legacy build, so I added build handling in 4fd0b86
I don't think we will actually need @rollup/plugin-data-uri in this case.
I am testing the official rollup plugins to check compatibility issues
Describe the bug
From the implementation of @rollup/plugin-data-uri, it looks that this plugin should work in Vite.
It fails in dev with an error in the browser:
And during build with error:
Reproduction
I created a repro using the vanilla template here https://github.com/matias-capeletto/vite-rollup-plugin-data-uri
System Info
vite
version: 2.0.0-beta.12The text was updated successfully, but these errors were encountered: