Skip to content

Commit

Permalink
docs: clarify target option, closes #769
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Nov 11, 2022
1 parent fd49cac commit 002cb99
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 43 deletions.
21 changes: 20 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,26 @@ Code splitting currently only works with the `esm` output format, and it's enabl
To disable code splitting altogether, try the `--no-splitting` flag instead.
### ES5 support
### Target environment
You can use the `target` option in `tsup.config.ts` or the `--target` flag to set the target environment for the generated JavaScript and/or CSS code. Each target environment is an environment name followed by a version number. The following environment names are currently supported:
- chrome
- edge
- firefox
- hermes
- ie
- ios
- node
- opera
- rhino
- safari
In addition, you can also specify JavaScript language versions such as `es2020`.
The value for `target` defaults to `compilerOptions.target` in your `tsconfig.json`, or `node14` if unspecified. For more information check out esbuild's [target](https://esbuild.github.io/api/#target) option.
#### ES5 support
You can use `--target es5` to compile the code down to es5, in this target your code will be transpiled by esbuild to es2020 first, and then transpiled to es5 by [SWC](https://swc.rs).
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"svelte": "3.46.4",
"ts-essentials": "9.1.2",
"tsconfig-paths": "3.12.0",
"tsup": "6.0.1",
"tsup": "6.4.0",
"typescript": "4.6.3",
"vitest": "0.21.1",
"wait-for-expect": "3.0.2"
Expand Down
50 changes: 9 additions & 41 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 002cb99

@vercel
Copy link

@vercel vercel bot commented on 002cb99 Nov 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.