Skip to content

When is tsc not enough? #8496

Answered by wujekbogdan
tyleralbee asked this question in Help
Discussion options

You must be logged in to vote

The short answer is: use a bundler when you need ... bundling :)

A bundler does a bunch of things, such as:

  • Bundling itself - it creates one *.js output file, while tsc emits as many *.js files as the number of *.ts files it compiles.
  • Tree shaking
  • You can import other file formats, such as *.graphql or *.css, with custom loaders.
  • It can apply polyfills, such as the __dirname shim for ESM.
  • It can apply precise environment targeting, e.g., with browserlists, while tsc only compiles to a predefined target (e.g., ES2022).

Replies: 2 comments 1 reply

Comment options

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

Answer selected by anthonyshew
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
Help
Labels
None yet
4 participants