Do we have the import.meta.env.SSR #3623
Answered
by
chenjiahan
nhattran998
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 🙏. |
Answered by
chenjiahan
Oct 2, 2024
Replies: 2 comments 1 reply
|
Rsbuild injects the following environment variables by default:
For export default defineConfig({
environments: {
web: {
source: {
define: {
'import.meta.env.SSR': false,
},
},
},
node: {
source: {
define: {
'import.meta.env.SSR': true,
},
},
output: {
target: 'node',
},
},
},
}); |
1 reply
Answer selected by
nhattran998
|
Update: It is |
0 replies
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.MODEimport.meta.env.BASE_URLimport.meta.env.PRODimport.meta.env.DEVFor
import.meta.env.SSR, you can set it through theenvironmentsconfiguration option: