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

test with subpath import (currently fails) #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ajvincent
Copy link

@ajvincent ajvincent commented Jun 22, 2024

I'm still trying to figure out why subpath imports don't work (#11). This pull request adds a test.

As far as I can tell, my previous attempt to fix this was in the wrong place entirely. When using relative paths, everything works. But when using a subpath import, tsimp's resolve and load hooks are never triggered for said import.

@ajvincent
Copy link
Author

ajvincent commented Jun 30, 2024

It looks like I actually guessed right to begin with. What I didn't realize is that, when the NodeJS process exits, it doesn't always log everything.

I figured out how to fix subpath import loading for my project: https://github.com/ajvincent/es-membrane/tree/20bea4e6483ea9f7f14facc5fbf9745415ae205a/build-utilities/loader-hooks

The debug folder has a debug-by-logging hook which you can add multiple times, using the hookName search parameter. It tries (successfully I think) to guarantee logging will always happen via a setImmediate() promise.

The subpath folder has my solution for resolving the subpath import just enough for tsimp to take over.

node --expose-gc --import=tsimp/import --import ./build-utilities/loader-hooks/subpath/registration.js ./build.ts

Porting this to tsimp should be straight-forward.

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

Successfully merging this pull request may close these issues.

None yet

1 participant