[Need Solution] Nuxt Public Runtime Config in Quasar #17254
Unanswered
UkonnRa
asked this question in
CLI - SSR mode
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Nuxt has Runtime Config which can read Env Vars in SSR mode. But Quasar does not have the same feature (at least in documentation).
Target
After
quasar build -m ssr, I hope the product can consume the given Enviroment Variables, likeVITE_TEST_VAL='<no matter what>' NODE_ENV='<no matter what>' node dist/ssr/index.js.Of course, the SPA mode should be workable as usual, following the old Vite's Env Var Replacement rule.
Solution / Found
MVP: https://github.com/UkonnRa/quasar-test, the secret sause is
import * as process from 'node:process', which may prevent the vite's Replacement.process.envin Vue components, or it will throwHydration completed but contains mismatcheserror:process.envin stores, everything should work fine, no error found.undefined, rather than using the value in.env, that's interesting.Conclusion
I think it's just hacking the
process.envpolyfill, hoping Quasar team can give a official solution about the runtime config.Beta Was this translation helpful? Give feedback.
All reactions