-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix: "Got unexpected undefined" error when using a re-exported type #7424
Fix: "Got unexpected undefined" error when using a re-exported type #7424
Conversation
|
Oh, I commited dummy data but I forgot to commit test code 🤣 |
I had just tried to migrate to parcel from rollup, and I'd bumped into this issue although using the latest version 2.4.1. I also tried nightly, but nothing works. Could the issues regarding this PR be re-opened? |
Please make a new issue with a reproduction. |
↪️ Pull Request
Fixes: #7360
Hi all 👋
When I investigated # 7360, I think that this bug may have occurred because the
resolveExports
ofTSModuleGraph
, which resolves the dependency of TypeScript type import/export, is returned even if it is undefined in this part (https://github.com/parcel-bundler/parcel/blob/v2/packages/transformers/typescript-types/src/TSModuleGraph.js#L146-L149). Originally,resolveExports
should return only when it is not undefined, asgetAllExports
does (https://github.com/parcel-bundler/parcel/blob/v2/packages/transformers/typescript-types/src/TSModuleGraph.js#L167-L169).The # 7360 issue can be resolved by changing the export order as follows, which also seems to support the above considerations.
before src/types/index.ts
after src/types/index.ts
if there is something I missed, please be free to point it out 🙇
💻 Examples
Bug repo: https://github.com/jakeboone02/parcel-basic-test
🚨 Test instructions
I made an integration test to check if
parcel-bundler
could handle a source that is shown in #7360 correctly.✔️ PR Todo