-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Add support for typescript project using composite option #19725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Failing test suitesCommit: 588699f test/integration/app-tree/test/index.test.js
Expand output● AppTree › production mode › should provide router context in AppTree on SSR
● AppTree › production mode › should provide router context in AppTree on CSR
● AppTree › production mode › should pass AppTree to NextPageContext
● AppTree › serverless mode › should provide router context in AppTree on SSR
● AppTree › serverless mode › should provide router context in AppTree on CSR
● AppTree › serverless mode › should pass AppTree to NextPageContext
test/integration/custom-server-types/test/index.test.js
Expand output● Custom Server TypeScript › should build server.ts correctly
test/integration/handle-non-page-in-pages/test/index.test.js
Expand output● Handle non-page in pages when target: serverless › Fails softly with descriptive error
test/integration/typescript-only-remove-type-imports/test/index.test.js
Expand output● TypeScript onlyRemoveTypeImports › production mode › should render a normal page correctly
● TypeScript onlyRemoveTypeImports › production mode › should render a page with type import correctly
● Test suite failed to run
test/integration/tsconfig-verifier/test/index.test.js
Expand output● tsconfig.json verifier › Creates a default tsconfig.json when one is missing
● tsconfig.json verifier › Works with an empty tsconfig.json (docs)
● tsconfig.json verifier › Updates an existing tsconfig.json without losing comments
● tsconfig.json verifier › allows you to set commonjs module mode
● tsconfig.json verifier › allows you to set es2020 module mode
|
Stats from current PRDefault Server ModeGeneral Overall increase
|
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
buildDuration | 9.8s | 9.7s | -75ms |
nodeModulesSize | 85 MB | 85 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.997 | 1.974 | -0.02 |
/ avg req/sec | 1251.66 | 1266.28 | +14.62 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.22 | 1.227 | |
/error-in-render avg req/sec | 2049.31 | 2038.28 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
677f882d2ed8..8b6e.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3c9ff84..1d7c.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fca3d..2eb1.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.01 kB | 8.01 kB | ✓ |
Client Build Manifests
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_buildManifest.js gzip | 321 B | 321 B | ✓ |
Overall change | 321 B | 321 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
index.html gzip | 614 B | 614 B | ✓ |
link.html gzip | 620 B | 620 B | ✓ |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB | ✓ |
Serverless Mode
General Overall increase ⚠️
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
buildDuration | 11.6s | 12s | |
nodeModulesSize | 85 MB | 85 MB |
Client Bundles (main, webpack, commons)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
677f882d2ed8..8b6e.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3c9ff84..1d7c.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fca3d..2eb1.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.01 kB | 8.01 kB | ✓ |
Client Build Manifests
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_buildManifest.js gzip | 321 B | 321 B | ✓ |
Overall change | 321 B | 321 B | ✓ |
Serverless bundles
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_error.js | 997 kB | 997 kB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 998 kB | 998 kB | ✓ |
link.js | 1.05 MB | 1.05 MB | ✓ |
routerDirect.js | 1.04 MB | 1.04 MB | ✓ |
withRouter.js | 1.04 MB | 1.04 MB | ✓ |
Overall change | 5.14 MB | 5.14 MB | ✓ |
588699f
to
e4e1dc1
Compare
e4e1dc1
to
3522dea
Compare
Stats from current PRDefault Server Mode (Decrease detected ✓)General Overall increase
|
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
buildDuration | 10s | 9.8s | -148ms |
nodeModulesSize | 85 MB | 85 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.015 | 2.064 | |
/ avg req/sec | 1240.51 | 1211.26 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.242 | 1.268 | |
/error-in-render avg req/sec | 2013.42 | 1971.49 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
677f882d2ed8..8b6e.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3c9ff84..1d7c.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fca3d..2eb1.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.01 kB | 8.01 kB | ✓ |
Client Build Manifests
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_buildManifest.js gzip | 321 B | 321 B | ✓ |
Overall change | 321 B | 321 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
index.html gzip | 614 B | 614 B | ✓ |
link.html gzip | 620 B | 620 B | ✓ |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB | ✓ |
Serverless Mode
General Overall increase ⚠️
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
buildDuration | 12s | 11.7s | -241ms |
nodeModulesSize | 85 MB | 85 MB |
Client Bundles (main, webpack, commons)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
677f882d2ed8..8b6e.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3c9ff84..1d7c.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fca3d..2eb1.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.01 kB | 8.01 kB | ✓ |
Client Build Manifests
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_buildManifest.js gzip | 321 B | 321 B | ✓ |
Overall change | 321 B | 321 B | ✓ |
Serverless bundles
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_error.js | 997 kB | 997 kB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 998 kB | 998 kB | ✓ |
link.js | 1.05 MB | 1.05 MB | ✓ |
routerDirect.js | 1.04 MB | 1.04 MB | ✓ |
withRouter.js | 1.04 MB | 1.04 MB | ✓ |
Overall change | 5.14 MB | 5.14 MB | ✓ |
Stats from current PRDefault Server Mode (Decrease detected ✓)General Overall increase
|
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
buildDuration | 9.9s | 9.9s | |
nodeModulesSize | 85 MB | 85 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.955 | 1.999 | |
/ avg req/sec | 1279.05 | 1250.65 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.198 | 1.221 | |
/error-in-render avg req/sec | 2086.51 | 2047.13 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
677f882d2ed8..8b6e.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3c9ff84..1d7c.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fca3d..2eb1.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.01 kB | 8.01 kB | ✓ |
Client Build Manifests
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_buildManifest.js gzip | 321 B | 321 B | ✓ |
Overall change | 321 B | 321 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
index.html gzip | 614 B | 614 B | ✓ |
link.html gzip | 620 B | 620 B | ✓ |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB | ✓ |
Serverless Mode
General Overall increase ⚠️
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
buildDuration | 11.7s | 11.9s | |
nodeModulesSize | 85 MB | 85 MB |
Client Bundles (main, webpack, commons)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
677f882d2ed8..8b6e.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3c9ff84..1d7c.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fca3d..2eb1.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.01 kB | 8.01 kB | ✓ |
Client Build Manifests
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_buildManifest.js gzip | 321 B | 321 B | ✓ |
Overall change | 321 B | 321 B | ✓ |
Serverless bundles
vercel/next.js canary | alxclark/next.js alx/typescript-remove-noEmit | Change | |
---|---|---|---|
_error.js | 997 kB | 997 kB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 998 kB | 998 kB | ✓ |
link.js | 1.05 MB | 1.05 MB | ✓ |
routerDirect.js | 1.04 MB | 1.04 MB | ✓ |
withRouter.js | 1.04 MB | 1.04 MB | ✓ |
Overall change | 5.14 MB | 5.14 MB | ✓ |
Failing test suitesCommit: e4e1dc1 test/integration/tsconfig-verifier/test/index.test.js
Expand output● tsconfig.json verifier › Creates a default tsconfig.json when one is missing
● tsconfig.json verifier › Works with an empty tsconfig.json (docs)
● tsconfig.json verifier › Updates an existing tsconfig.json without losing comments
● tsconfig.json verifier › allows you to set commonjs module mode
● tsconfig.json verifier › allows you to set es2020 module mode
● tsconfig.json verifier › allows you to build for project references
|
Failing test suitesCommit: 3522dea test/integration/tsconfig-verifier/test/index.test.js
Expand output● tsconfig.json verifier › Creates a default tsconfig.json when one is missing
● tsconfig.json verifier › Works with an empty tsconfig.json (docs)
● tsconfig.json verifier › Updates an existing tsconfig.json without losing comments
● tsconfig.json verifier › allows you to set commonjs module mode
● tsconfig.json verifier › allows you to set es2020 module mode
● tsconfig.json verifier › allows you to build for project references
|
What is this solving ?
Fixes #16364
Currently, when using the typescript composite option in a root
tsconfig.json
file, Next will rewrite the configuration file to addnoEmit: true
. This results in an error when runningtsc
which occurs when bothcomposite
andnoEmit
are present in atsconfig.json
. Here's a thread on the TS error in question microsoft/TypeScript#36917.How are you solving it ?
Change
noEmit
foremitDeclarationOnly
when we detect thecomposite
option, making typescript emit only.d.ts
files. This solution was proposed in both microsoft/TypeScript#36917 and microsoft/TypeScript#33809.Notes
composite
to build for project reference..d.ts
files might be problematic for projects that don't include anoutDir
(like most of the examples), since.d.ts
files will be created next to each.ts
or.tsx
file. I personally redirect the output to a/build/ts
directory and we could suggest something similar if the option is unset.