-
Notifications
You must be signed in to change notification settings - Fork 71
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
Generated types placed in unexpected directory -- need to set rootDir
in tsconfig
#275
Comments
What happens without |
Same result |
Typescript adds Another option is to set declaration dir to a different folder and, if you are creating npm package, set |
Thanks for the suggestions! |
@ezolenko is there no way to control the actual final output for |
In case anyone else runs into this, essentially if you have more that one directory you are including in your tsconfig or more than one entry point in your rollup config as described above, typescript will follow the folder structure instead of putting the index.d.ts in the root of the destination folder (regardless of trying to use the To fix it you can either:
|
I struggled with this for a few days (all suggested solutions not worked or not appropriate for me) and finally found out why. |
So the root cause here is how TS automatically detects your I diagnosed this myself a couple years ago in jaredpalmer/tsdx#504, so for better or for worse, am well aware of how this configuration of TS works. This isn't a bug in rpt2 but the same behavior that TS/
This is different from OP and has very little context to go off of, but I would suspect that would be because some JS file is now in your |
rootDir
rootDir
rootDir
in tsconfig
What happens and why it is wrong
I'm building a package using React, Typescript, Rollup, rollup-plugin-typescript2.
While the generated JS files are fine, the generated definition files are in the wrong directory.
Current result:
Expected result:
Environment
Mac, Node v15.14.0
Versions
rollup.config.js
`rollup.config.js`:
tsconfig.json
`tsconfig.json`:
package.json
`package.json`:
plugin output with verbosity 3
plugin output with verbosity 3:
The text was updated successfully, but these errors were encountered: