[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
-
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.env
in Vue components, or it will throwHydration completed but contains mismatches
error:process.env
in 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.env
polyfill, hoping Quasar team can give a official solution about the runtime config.Beta Was this translation helpful? Give feedback.
All reactions