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

Allow cleanup of register() #63

Closed
TylorS opened this issue Nov 10, 2018 · 1 comment · Fixed by #64
Closed

Allow cleanup of register() #63

TylorS opened this issue Nov 10, 2018 · 1 comment · Fixed by #64

Comments

@TylorS
Copy link
Contributor

TylorS commented Nov 10, 2018

Hello, first of all thank you for this very useful library! I've been working on some TypeScript tooling myself and this makes using paths some much easier.

However in testing scenarios it's useful to be able to cleanup some of the side-effects that are being caused by register. I'd propose returning a function from register() that would reassign Module._resolveFilename back to originalResolveFilename. I'll happily make the PR if this seems aligned with your goals of this library as well

@jonaskello
Copy link
Member

I think this seems useful and it should not affect existing users so I don't see any problems adding it.

It does change the API but since the register() function currently returns void I guess it will not really break anyone so I would consider it a minor version increment as it is backwards compatible.

So feel free to go ahead and make a PR for it :-). If you do, please also update the README to reflect the API change.

TylorS pushed a commit to TylorS/tsconfig-paths that referenced this issue Nov 10, 2018
register() updated to return a function to re-instate original
filename resolver.

Closes dividab#63
jonaskello pushed a commit that referenced this issue Nov 11, 2018
register() updated to return a function to re-instate original
filename resolver.

Closes #63
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 a pull request may close this issue.

2 participants