Skip to content

Commit

Permalink
feat!: don't split tsconfig.dom.json into two files (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Apr 23, 2023
1 parent 9243fc7 commit ef50567
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
22 changes: 4 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ Add one of the available configurations to your `tsconfig.json`:
### Configuration for Browser Environment

```json
"extends": [
"@vue/tsconfig/tsconfig.json",
"@vue/tsconfig/tsconfig.dom.json"
]
"extends": "@vue/tsconfig/tsconfig.dom.json"
```

### Configuration for Node Environments
Expand Down Expand Up @@ -56,31 +53,20 @@ Make sure to place `@vue/tsconfig/tsconfig.json` *after* `@tsconfig/node18/tscon
## Migrating from TypeScript < 5.0

- The usage of base `tsconfig.json` is unchanged.
- `tsconfig.web.json` is now renamed to `tsconfig.dom.json`, to align with `@vue/runtime-dom` and `@vue/compiler-dom`, and it only contains dom-specific options, you need to use it in conjunction with the base `tsconfig.json`:

```json
"extends": [
"@vue/tsconfig/tsconfig.json",
"@vue/tsconfig/tsconfig.dom.json"
]
```

- `tsconfig.web.json` is now renamed to `tsconfig.dom.json`, to align with `@vue/runtime-dom` and `@vue/compiler-dom`.
- `tsconfig.node.json` is removed, please read the [Node.js section](#configuration-for-node-environments) above for Node.js usage.

Some configurations have been updated, which might affect your projects:

- `moduleResolution` changed from `node` to [`bundler`](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#moduleresolution-bundler)
- The `lib` option in `tsconfig.dom.json` now includes `ES2020` by default.
- The `lib` option in `tsconfig.dom .json` now includes `ES2020` by default.
- Previously it was ES2016, which was the lowest ES version that Vue 3 supports.
- Vite 4 transpiles down to ES2020 by default, this new default is to align with the build tool.
- This change won't throw any new errors on your existing code, but if you are targeting old browsers and want TypeScript to throw errors on newer features used, you can override the `lib` option in your `tsconfig.json`:

```json
{
"extends": [
"@vue/tsconfig/tsconfig.json",
"@vue/tsconfig/tsconfig.dom.json"
],
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"lib": ["ES2016", "DOM", "DOM.Iterable"]
}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.dom.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"lib": [
// Target ES2020 to align with Vite.
Expand Down

0 comments on commit ef50567

Please sign in to comment.