Commit 5da86c5
authored
build: update packages to use more modern moduleresolution options (#1770)
* refactor: rename tsconfig.cjs.json to tsconfig.esm.json
* build: update packages to use more modern moduleresolution options
This change updates tsconfigs across all packages to use more up to date `module` and `moduleResolution` options. For all packages that were being built as `commonjs` modules with node `moduleResolution`, they've been updated to use `nodenext`.
I also took the opportunity to re-organize the tsconfigs at the packages level to make their names more accurate. Previously the main `packages/tsconfig.json`, which is what the `build:esm` command targetted, referenced all package's tsconfigs, while a `packages/tsconfig.cjs.json` only referenced the cjs tsconfig from the react package. However, all packages' tsconfigs _except_ for the react tsconfig are building cjs. So having a command that's called `build:esm` run all cjs builds and one esm build didn't really do what the name would suggest. So I reversed that construct. Now `packages/tsconfig.json` still references all of the packages tsconfig, except for the react package, it references the `tsconfig.cjs`, and I renamed the `packages/tsconfig.cjs.json` to `packages/tsconfig.esm.json` and have it only referencing the main react package tsconfig.
The net / net is that `build:esm` is only building esm output and `build:cjs` is only building cjs output.
Similarly, all package level tsconfigs are inheriting from packages/tsconfig.options.json, but that config had module and moduleResolution corresponding to the tsconfig in react (the ESM one), and all of the other package tsconfigs were overriding the module and moduleResolution. So I swapped that, so that the base config has the module and moduleResolution that all but on of the packages are using, and had the react tsconfig override that to what it needed to be for esm output. This means fewer tsconfigs are needing to override those options.
Lastly, I've done build comparisons for all packages and target, and they all result in the same build output as they did before these changes.1 parent 04f6280 commit 5da86c5
File tree
20 files changed
+23
-32
lines changed- packages
- babel-plugin-strip-runtime
- babel-plugin
- benchmark
- codemods
- css
- eslint-plugin
- jest
- parcel-optimizer
- parcel-transformer-external
- parcel-transformer
- react
- utils
- webpack-loader
20 files changed
+23
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
0 commit comments