-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Weird import default error #86
Comments
Thanks for the issue. I can't reproduce though. Can you link to a repository containing a minimal reproduction? |
Yeah no problem, I will put that together and update with a link. |
Will re-open once reproduction is provided |
I have a minimal reproduction at https://github.com/TehShrike/tsx_issue_86_repro I ran into the issue importing TypeScript files from a module. |
Thanks for the reproduction @TehShrike Your issue is the same as #38 |
Bug description
When utilizing the
@tensorflow-models/universal-sentence-encoder
npm package, we experienced a weird bug that went unnoticed until deployment to production. We utilizedesmo
by @antfu for all local dev development on a typescript express api.Using:
import use from '@tensorflow-models/universal-sentence-encoder'
in our script worked perfectly locally. After building (ts->cjs/esm) and deploying to production, we got errors essentially saying many of the module functions wereundefined
.After messing with it, we discovered that updating the import statement to:
import * as use from '@tensorflow-models/universal-sentence-encoder'
fixed the issue both when running uncompiled ts from the cli and post-build js in our production environment.
I'm not familiar enough with the build process ts->cjs/esm to understand the details of what could cause this. However, on the face of it, it does seem to me that if an import would fail post-compile, then tsx should fail too.
Reproduction
import use from '@tensorflow-models/universal-sentence-encoder'
tsc -p ./tsconfig.json
model = await use.load()
in the resulting codeimport * as use from '@tensorflow-models/universal-sentence-encoder'
Environment
Can you contribute a fix?
The text was updated successfully, but these errors were encountered: