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
I'd like to use a reference to a JS file to be loaded on-demand. In development, I can use the import ("path?url") or new URL("path", import.meta.url).hrf approaches outlined in static assets to get the resolved url to the file.
In production, the file is inlined (data:application/javascript;base64,ZXhw) regardless of the method I use. I would expect this to resolve to something like assets/path-9d3f80c0.js.
I think the approaches outlined in #2173 might work, but it would be ideal if url was honored and not inlined.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I'd like to use a reference to a JS file to be loaded on-demand. In development, I can use the
import ("path?url")
ornew URL("path", import.meta.url).hrf
approaches outlined in static assets to get the resolved url to the file.In production, the file is inlined (
data:application/javascript;base64,ZXhw
) regardless of the method I use. I would expect this to resolve to something likeassets/path-9d3f80c0.js
.I think the approaches outlined in #2173 might work, but it would be ideal if url was honored and not inlined.
Reproduction
https://stackblitz.com/edit/vitejs-vite-9w3pt3?file=main.js,.vscode%2Fsettings.json,package.json&terminal=prod
Steps to reproduce
Run
npm run build && npm run preview
Run
npm run dev
(or see this example) to see thedev
behavior.System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: