Skip to content
Discussion options

You must be logged in to vote

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 the environments configuration option:

export default defineConfig({
  environments: {
    web: {
      source: {
        define: {
          'import.meta.env.SSR': false,
        },
      },
    },
    node: {
      source: {
        define: {
          'import.meta.env.SSR': true,
        },
      },
      output: {
        target: 'node',
      },
    },
  },
});

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@nhattran998
Comment options

Answer selected by nhattran998
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants