-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
ts-node should take into account tsconfig paths in esm mode and keep but transpile imports #2023
Comments
my error: ERR_INVALID_MODULE_SPECIFIER
More contextI have some esm only deps, some cjs only deps and some universal ones. I need export * from "date-fns"; shared/utils/date.client.ts: export * from "date-fns/esm"; |
Can I implement it myself? |
I also found this:
I do use tsconfig-paths/register, but looks it does not work (see my tsconfig.json files) |
I dig into ts-node and tsconfig-paths and realised: there is on good thing, registering is works: also, I tried remove typescript-transform-paths or swap requirement order |
@a-x- I am facing similar issue when I am using paths in tsconfig.json with V8 WDIO.
Package.json
Getting Error:
How did you resolve it? |
This has done the trick for me: #1450 (comment) |
This helped me and appears to be the recommended solution: |
Search Terms
what I found:
Expected Behavior
Take tsconfig.json paths into account even in esm mode. Keep imports, but transpile paths.
Actual Behavior
imports keeping as is in esm mode. One good thing I have: VSCode have not TS errors in this setup now, it was hard to accomplish it too.
Steps to reproduce the problem
{ "compilerOptions": { "paths": { "foo": "src/bar.ts" } } }
ts-node-esm --project tsconfig.json src/index.ts
import foo from 'foo'
and create some src/bar.ts file with default exportMinimal reproduction
will be later
Specifications
I have complex monorepo setup with 3 tsconfigs and many other things, I'll show later minimal repo if it really needed in this case... It's vitejs front and ts-node BFF for it I trying to implement now with shared utils.
server/tsconfig.json
shared/tsconfig.json
package.json (root)
shared/package.json
src: package.json and tsconfig.json currently are not interesting as they using for client-side/front
The text was updated successfully, but these errors were encountered: