-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Register does not transpile node_module dependencies #769
Comments
Can you provide a minimal reproduction? |
Install
Then run:
The first import will work, the second one will fails as swc will pick the |
#767 should resolved this |
I tried v1.9.1 which should include this fix but it still fails 🤔 |
I am having the same issue. In my case I am distributing an intranet package as .ts rather than .js and wish to transpile it on the fly, however swc-node ignores files in node_modules. In particular, it is happening here: swc-node/packages/register/esm.mts Lines 271 to 275 in 82aa094
While I understand that the basic use of swc-node/register doesn't require transpiling in node_modules, could you please modify the above condition to not exclude node_modules if url ends with alternatively, please expose some sort of flag/ env variables/option to transpile .ts files in node_modules too thanks |
I have a 3rd party dependency that internally relies on https://github.com/google/zx . Now
zx
does not publish with cjs, only ESM, and when I try to runmy-script.ts
that includes the dependency via:I get an error:
Obviously, cannot change the 3rd party dependency import statements. Also this was marked as "resolved" in #634 but seems like it works only on 1st level imports?
Other tools handle this properly (eg
node -r esbuild-register
) but I'd love to stick with SWC 🙏The text was updated successfully, but these errors were encountered: