Closed jarrodldavis closed 4 months ago
I ran a git bisect
locally and it points to this PR: https://github.com/getsentry/spotlight/pull/434
Looking at that PR, no configuration changes seem obvious to cause this change, but I did notice that vite-plugin.ts
imports from ../package.json
. By default, TypeScript automatically computes a rootDir
, and uses that value to preserve the directory structure in outDir
. Because of that new import, the computed rootDir
changed from src
under packages/spotlight
to packages/spotlight
itself, causing all of the type declarations to be emitted to the new dist/src
directory.
Updating tsconfig.json
like this fixes the issue and emits the declaration files to the same place they were in 2.0.0
:
diff --git a/packages/spotlight/tsconfig.json b/packages/spotlight/tsconfig.json
index 421f99c..908d68e 100644
--- a/packages/spotlight/tsconfig.json
+++ b/packages/spotlight/tsconfig.json
@@ -6,7 +6,8 @@
"emitDeclarationOnly": true,
"declaration": true,
"noEmit": false,
- "outDir": "dist"
+ "outDir": "dist",
+ "rootDir": "src"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
Ouch and thanks so much for the detective work @jarrodldavis! Patch coming up now!
Environment
Node v20.14.0, pnpm v9.6.0
Steps to Reproduce
@spotlightjs/spotlight
from2.0.0
to2.1.0
usingpnpm update --latest
Expected Result
TypeScript types still work.
Actual Result
I get an error from TypeScript that it can't find a declaration file for
@spotlightjs/spotlight
. Inspectingnode_modules
confirms that indeed, no declaration files (*.d.ts
) files are present for the@spotlightjs/spotlight
package wherepackage.json
declares them to be:https://github.com/getsentry/spotlight/blob/87c82e8fa61cc378b9cc81bfde9d971af69502c7/packages/spotlight/package.json#L23-L26
Here is the
dist
folder for2.0.0
(which TypeScript was happy with):And here is
dist
in2.1.0
:It appears that the declaration files have been moved into that new
dist/src
folder:Patching
package.json
like this seems to work: