Do we have the import.meta.env.SSR #3623
Answered
by
chenjiahan
harrytran998
asked this question in
Q&A
-
Thank teams for the great tools <3. After reading the docs - https://rsbuild.dev/guide/advanced/env-vars and https://rsbuild.dev/guide/advanced/ssr, I don't see any place disscuss about this. So, how can I do this with RsBuild 🙏. |
Beta Was this translation helpful? Give feedback.
Answered by
chenjiahan
Oct 2, 2024
Replies: 1 comment 1 reply
-
Rsbuild injects the following environment variables by default:
For export default defineConfig({
environments: {
web: {
source: {
define: {
'import.meta.env.SSR': JSON.stringify(false),
},
},
},
node: {
source: {
define: {
'import.meta.env.SSR': JSON.stringify(true),
},
},
output: {
target: 'node',
},
},
},
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
harrytran998
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rsbuild injects the following environment variables by default:
import.meta.env.MODE
import.meta.env.BASE_URL
import.meta.env.PROD
import.meta.env.DEV
For
import.meta.env.SSR
, you can set it through theenvironments
configuration option: