-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Purely dynamic import with dependency returns empty MIME type #2525
Comments
Hmm yeah I think a reasonable timeout should fix this... can you try it? |
I did, and it does fix it. Should I draft a Pull request? |
PS: I was thinking of 5 seconds timeout to take slow ws into account. |
Is the MIME type error the only issue here? Does it actually cause any other problems? |
When responding with the MIME, another issue occurs saying the import does not export anything.
The naive in me says: "The server could respond with the compiled/optimized file even with a delay and avoid the reload." |
I made a quick PR with a test for it. I like my initial solution because it works. I will keep on hacking but since I do not know when/if I will make more progress soon, my PR can be merged as is. |
As a user, I might click on a dependency and get a complete re-init of my page (no state would be kept). When working on an app without routing that could prove unsavory. I looked into avoiding this refresh, it is more complicated than I naively thought. I will keep on hacking and reporting my findings. |
Describe the bug
I want to purely dynamically import a file that has npm dependencies. When doing so, the dependencies are found and optimized at runtime. When they are found (and not yet optimized), I get the following error:
Reproduction
https://github.com/elevatebart/vite/tree/fix/import-depnedncy-mime-type/packages/playground/dynamic-import
In this example, I added an npm dependency to the dynamic-import playground under the 'bar' view.
When I click on the 'bar' button, I get the error before I refresh.
System Info
vite
version: 2.1.0Logs (Optional if provided reproduction)
vite
orvite build
with the--debug
flag.Investigation results
On this line we return an invalid MIME type that could block some testing engines and wrongly flag some pages as faulty.
Would it make sense to simply not respond or respond with a timeout instead?
I would have this kind of idea in mind:
Awaiting your opinion before suggesting a fix.
Surfing the Vite wave!
Amicalement
The text was updated successfully, but these errors were encountered: