-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
nuxt/framework
#8106Labels
Description
Environment
- Operating System:
Linux - Node Version:
v14.19.3 - Nuxt Version:
3.0.0-rc.11 - Nitro Version:
0.5.4 - Package Manager:
yarn@1.22.19 - Builder:
vite - User Config:
ssr,css - Runtime Modules:
- - Build Modules:
-
Reproduction
https://codesandbox.io/s/distracted-cookies-x37yoi?file=/assets/css/main.css
(Let me know if that link does not work for you)
Describe the bug
We have a server middleware to dynamically enable/disable SSR depending on the user agent.
In nuxt.config.ts we set ssr: true, our middleware then overrides this using
event.req.headers['x-nuxt-no-ssr'] = 'true';
if serving a user agent that should not get server side rendering.
This leads to problems when using assets in CSS files:
[nuxt] [request error] [unhandled] [500] globalThis.__buildAssetsURL is not a function
at ./.output/server/chunks/app/styles.mjs:7:276
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async renderInlineStyles (./.output/server/chunks/handlers/renderer.mjs:453:20)
at async ./.output/server/chunks/handlers/renderer.mjs:386:25
at async ./.output/server/chunks/handlers/renderer.mjs:30:22
at async ./.output/server/node_modules/h3/dist/index.mjs:592:19
at async Server.nodeHandler (./.output/server/node_modules/h3/dist/index.mjs:538:7)
Note that this only happens in production mode, dev mode is fine.
Additional context
No response
Logs
No response
Reactions are currently unavailable