Running vite build in a workspace matching the following conditions can fail with an error from esbuild:
The monorepo contains a root-level tsconfig.json.
That root-level tsconfig.json extends a shared tsconfig.json.
The shared tsconfig.json is exposed via the package.json exports field.
The workspace has an independent tsconfig.json of its own
After a period of time (<1 min on my test repo, 2-3+ minutes in others), the build process will error out with a lengthy Go stack trace and exit with abnormally with an error.
Notes
workspace-level tsconfig.json files extending one of the shared configs work fine. The issue does not arise until there is a root tsconfig.json and a workspace tsconfig.json.
I have not tested if using a relative extends (example: ../../tsconfig.json) resolves the issue
Remove the exports from the shared tsconfigs package, and rewrite the extends to use the preset files directly (example: "extends": "tsconfigs/configs/node.json")
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
Running
vite build
in a workspace matching the following conditions can fail with an error fromesbuild
:tsconfig.json
.tsconfig.json
extends a sharedtsconfig.json
.tsconfig.json
is exposed via the package.jsonexports
field.tsconfig.json
of its ownAfter a period of time (<1 min on my test repo, 2-3+ minutes in others), the build process will error out with a lengthy Go stack trace and exit with abnormally with an error.
Notes
tsconfig.json
files extending one of the shared configs work fine. The issue does not arise until there is a roottsconfig.json
and a workspacetsconfig.json
.extends
(example:../../tsconfig.json
) resolves the issueThings that work as expected
Removing the
extends
vite-tsconfig-extends-repro:515bb73
Description
Rewriting the root
tsconfig.json
to not require use of anextends
and removing it.Steps
git clone https://github.com/bskinner-pfizer/vite-tsconfig-extends-repro.git
git checkout fix-removes-extends
yarn install
yarn workspace vite-demo build
Directly use the shared
tsconfig.json
instead of usingexports
vite-tsconfig-extends-repro:a0845fd
Description
Remove the
exports
from the sharedtsconfigs
package, and rewrite theextends
to use the preset files directly (example:"extends": "tsconfigs/configs/node.json"
)Steps
git clone https://github.com/bskinner-pfizer/vite-tsconfig-extends-repro.git
git checkout fix-avoid-using-exports
yarn install
yarn workspace vite-demo build
Reproduction
https://github.com/bskinner-pfizer/vite-tsconfig-extends-repro
Steps to reproduce
git clone https://github.com/bskinner-pfizer/vite-tsconfig-extends-repro.git
yarn install
yarn workspace vite-demo build
System Info
Used Package Manager
yarn
Logs
Vite build output
_log is truncated due to length. There are a **lot** of the `goroutine` statements printed_ ```shell ... goroutine 52 [GC worker (idle)]: runtime.gopark(0xd9a580fc87b?, 0x1?, 0x69?, 0xca?, 0x0?) runtime/proc.go:381 +0xd6 fp=0xc000323f50 sp=0xc000323f30 pc=0x438536 runtime.gcBgMarkWorker() runtime/mgc.go:1275 +0xf1 fp=0xc000323fe0 sp=0xc000323f50 pc=0x41a7f1 runtime.goexit() runtime/asm_amd64.s:1598 +0x1 fp=0xc000323fe8 sp=0xc000323fe0 pc=0x469e41 created by runtime.gcBgMarkStartWorkers runtime/mgc.go:1199 +0x25 goroutine 53 [GC worker (idle)]: runtime.gopark(0xd9a580fc88e?, 0x1?, 0x10?, 0xac?, 0x0?) runtime/proc.go:381 +0xd6 fp=0xc000324750 sp=0xc000324730 pc=0x438536 runtime.gcBgMarkWorker() runtime/mgc.go:1275 +0xf1 fp=0xc0003247e0 sp=0xc000324750 pc=0x41a7f1 runtime.goexit() runtime/asm_amd64.s:1598 +0x1 fp=0xc0003247e8 sp=0xc0003247e0 pc=0x469e41 created by runtime.gcBgMarkStartWorkers runtime/mgc.go:1199 +0x25 goroutine 54 [GC worker (idle)]: runtime.gopark(0xd9a580fd058?, 0x3?, 0x7?, 0x4a?, 0x0?) runtime/proc.go:381 +0xd6 fp=0xc000324f50 sp=0xc000324f30 pc=0x438536 runtime.gcBgMarkWorker() runtime/mgc.go:1275 +0xf1 fp=0xc000324fe0 sp=0xc000324f50 pc=0x41a7f1 runtime.goexit() runtime/asm_amd64.s:1598 +0x1 fp=0xc000324fe8 sp=0xc000324fe0 pc=0x469e41 created by runtime.gcBgMarkStartWorkers runtime/mgc.go:1199 +0x25 goroutine 55 [GC worker (idle)]: runtime.gopark(0xd9681e02df1?, 0x3?, 0x91?, 0x2b?, 0x0?) runtime/proc.go:381 +0xd6 fp=0xc000325750 sp=0xc000325730 pc=0x438536 runtime.gcBgMarkWorker() runtime/mgc.go:1275 +0xf1 fp=0xc0003257e0 sp=0xc000325750 pc=0x41a7f1 runtime.goexit() runtime/asm_amd64.s:1598 +0x1 fp=0xc0003257e8 sp=0xc0003257e0 pc=0x469e41 created by runtime.gcBgMarkStartWorkers runtime/mgc.go:1199 +0x25 failed to load config from /path/to/vite-tsconfig-extends-repro/packages/vite-demo/vite.config.ts error during build: Error: The service was stopped at /path/to/vite-tsconfig-extends-repro/.yarn/unplugged/esbuild-npm-0.21.5-d85dfbc965/node_modules/esbuild/lib/main.js:968:34 at responseCallbacks.Validations