Skip to content
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

why can the vscode recognize the source path when the exports field in not include the src #501

Closed
Hujianboo opened this issue Jul 16, 2022 · 2 comments

Comments

@Hujianboo
Copy link

thx for sharing this repo!
I have one question.
The exports described in compoents is the output path and not include src
"exports": { ".": "./dist/index.js", "./package.json": "./package.json" },
But when editing the import of comeponent in the vscode,
import { Main } from '@sample/components';
it will navigate to 'sample-monorepo/packages/component/src/index'.
why is it that? I think the correct path is to the dist/index.d.ts if has build by tsc or failed to find module if hasn't build

@Hujianboo
Copy link
Author

I have figured out the reason.
Since from ts3.7, instead of using .d.ts files from project references,using original source files unless the disableSourceOfProjectReferenceRedirect is open
microsoft/TypeScript#32028 (comment)
according to microsoft/TypeScript#32028 (comment)
I think the declartionMap can be closed in tsconfig.base.json because the editor don't use the .d.map files now Since version 3.7.

@Hujianboo Hujianboo reopened this Jul 16, 2022
@AviVahl
Copy link
Collaborator

AviVahl commented Jul 16, 2022

Yes, it's the project references that cause the dev-time redirect. That's part of the point of using it... Getting that immediate update even if I didn't build.

I'm building .d.ts.map files, as I usually also publish the src folder and it's a nicer experience IMO for the npm consumer to Ctrl/Cmd+Click and jump to the source of the package he's looking at in node_modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants