You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched for existing issues that already report this problem, without success.
Stencil Version
Stencil 5.0.0-rc.15
Current Behavior
Our Stencil package lives at packages/web-components/ and imports TypeScript source from the repository’s shared/ directory. stencil.config.ts selects tsconfig.build.json, which sets compilerOptions.rootDir to "../.." so both directories are within the TypeScript root.
During stencil build, getTsOptionsToExtend() sets TypeScript’s rootDir to Stencil’s config.rootDir, which points to the package directory. TypeScript then reports TS6059 because the imported shared files fall outside that directory.
Expected Behavior
Stencil should honor an explicit compilerOptions.rootDir from the selected tsconfig and fall back to config.rootDir when the option is unset. TypeScript rootDir reference
Steps to Reproduce
Create a Stencil project at packages/web-components/ in a monorepo using @stencil/[email protected].
Set tsconfig: 'tsconfig.build.json' in stencil.config.ts and set compilerOptions.rootDir to "../.." in that tsconfig.
Import a function from a .ts file in the repository-level shared/ directory and call it from a Stencil component.
Run stencil build from packages/web-components/. The TS6059 diagnostic identifies the shared file and uses the Stencil package directory as rootDir.
Environment
Stencil 5.0.0-rc.15 in a pnpm workspace on Windows.
I can take this. getTsOptionsToExtend in packages/core/src/compiler/transpile/ts-config.ts hardcodes rootDir: config.rootDir, which overrides compilerOptions.rootDir from the selected tsconfig. I'll use the tsconfig value when it is set and fall back to config.rootDir, with unit tests. Is v5 the right base branch for this?
Activity
[-]bug: Stencil 5.0.0 overrides TypeScript’s `rootDir`, causing TS6059 for shared monorepo source[/-][+]bug: Stencil v5 overrides TypeScript’s `rootDir`, causing TS6059 for shared monorepo source[/+]harshbhx commentedon Nov 28, 2026
I can take this.
getTsOptionsToExtendinpackages/core/src/compiler/transpile/ts-config.tshardcodesrootDir: config.rootDir, which overridescompilerOptions.rootDirfrom the selected tsconfig. I'll use the tsconfig value when it is set and fall back toconfig.rootDir, with unit tests. Isv5the right base branch for this?