bridge
bridge copied to clipboard
_nuxt/empty.js was blocked with vite:true and ssr:false
Environment
- Operating System:
Linux
- Node Version:
v14.19.3
- Nuxt Version:
2.16.0-27720022.54e852f
- Nitro Version:
0.5.4
- Package Manager:
[email protected]
- Builder:
vite
- User Config:
bridge
,ssr
,serverHandlers
,devServerHandlers
,buildModules
- Runtime Modules:
-
- Build Modules:
()
,@nuxt/[email protected]
Reproduction
- Open the default CodeSandbox template: https://codesandbox.io/p/github/nuxt/starter/tree/v2-bridge-codesandbox
- Replace
nuxt.config.js
with this:
import { defineNuxtConfig } from "@nuxt/bridge";
export default defineNuxtConfig({
bridge: {
vite: true
},
ssr: false
});
(or open this CodeSandbox where I already replaced the config: https://codesandbox.io/s/nuxt-bridge-vite-empty-error-ee3gjg?file=/nuxt.config.js)
- In Firefox, open the console (the error does not show in the sandbox console) and see the error:
Loading module from “https://ee3gjg.sse.codesandbox.io/_nuxt/empty.js” was blocked because of a disallowed MIME type (“text/html”).
Loading failed for the module with source “https://ee3gjg.sse.codesandbox.io/_nuxt/empty.js”.
- In Chrome open the console and see the error:
empty.js: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
- See that the page does not load
Describe the bug
When using vite: true
and ssr: false
in Nuxt/bridge, the page does not load and in your browser console you find an error telling that the file empty.js
was blocked because it has the wrong MIME-type.
Additional context
No response
Logs
No response
đź‘Ť , facing the same issue
We are facing the same issue too.
Facing the same issue.
Facing the same issue.
same here
Same here, setting ssr:false
gives this error.
@danielroe Any ideas here? Happy to look into it otherwise
Same issue here.
Would welcome it, thank you @joel-wenzel 🙏
I just ran into this same issue
Does anybody know a workaround for this issue? Our "nuxi dev" gets slower and slower, so we would really like to use Vite soon.
Why does nuxt bridge have this problem with ssr false? it is not suposed to work with ssg?
Hello, everyone, who still waiting for the solution. I've found a workaround for this feature, because ssr: false
, looks completely broken rn
We can overcome this by using Nitro routeRules
import { defineEventHandler } from 'h3'
import { defineNuxtConfig } from '@nuxt/bridge'
export default defineNuxtConfig({
/* ... you old config */
nitro: {
routeRules: {
'/*': { ssr: false }
}
},
// ssr: false,
})
I am also experiencing this. The workaround from @AndreyYolkin did not work for me.
I am also experiencing this. The workaround from @AndreyYolkin did not work for me.
Do you have nitro enabled? And also: webpack or vite? Will try to help
Yes I have nitro enabled. In my bridge options I set vite: true. Everything works if I set vite: false
I just created an empty repo with just nuxt and nuxt bridge installed.
This is all that is in the nuxt config. If I set SSR to true the problem goes away.
import { defineNuxtConfig } from '@nuxt/bridge'
export default defineNuxtConfig({
bridge: {
nitro: true,
vite: true,
},
ssr: false,
})
`
https://github.com/AndreyYolkin/nuxt-bridge-app-spa this seems to be ok (despite the ENOENT error, which I've already submitted as https://github.com/nuxt/bridge/issues/734)
thanks @AndreyYolkin I'm one step closer. Now experiencing the same ENOENT issue.
The issue has been resolved in https://github.com/nuxt/bridge/pull/775. cc: @danielroe