Skip to content

How to build multiple entries with different targets #1565

Answered by chenjiahan
longht021189 asked this question in Q&A
Discussion options

You must be logged in to vote

You can use tools.rspack to set different entries or aliases for different targets. We will support this feature in the Rsbuild configuration later.

export default defineConfig({
  output: {
    targets: ['web', 'node']
  },
  tools: {
    rspack(config, { target }) {
      if (target === 'web') {
        config.entry = {};
        config.resolve!.alias = {};
      } else {
        // ...
      }
    }
  }
});

Replies: 1 comment 1 reply

Comment options

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

Answer selected by longht021189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants