[dev-server-esbuild] Unable to resolve packages with correct extensions when imported in an .ts file using node's `exports`
See original GitHub issueWhen files being imported in an .ts
file, the resolver automatically assumes all the imports must be ended with .ts
when some could be .js
. It seems like the dev server does not support node’s exports
quite well.
Actual behavior
Packages that use exports
in node resolves with .ts
when it gets imported in a .ts
file.
Expected behavior
Packages that use exports
in node must be resolved with the correct extensions when it gets imported in a .ts
file
Steps to reproduce
Clone this repo and run the project to reproduce the stated problem.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:18 (13 by maintainers)
Top Results From Across the Web
Documentation - ECMAScript Modules in Node.js - TypeScript
When a .ts file is compiled as an ES module, ECMAScript import / export syntax ... fail in ES modules because relative import...
Read more >Unable to import ESM .ts module in node - Stack Overflow
No matter what I do, I can't get beyond Unknown file extension ".ts" when I try to run my code using node --experimental-specifier-resolution= ......
Read more >Module Methods - webpack
No CommonJS allowed, for example, you can't use require , module.exports or exports; File extensions are required when importing, e.g, you should use...
Read more >Announcing TypeScript 4.7 RC - Microsoft Developer Blogs
When a .ts file is compiled as an ES module, ECMAScript import / export ... In some cases, Node.js also synthesizes named exports...
Read more >Dependency resolution - Parcel
import '../constants';. Note that these may only be omitted when importing from a JavaScript or TypeScript file. File extensions are always required for ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@LarsDenBakker @motss I think I am running into the same or similar issue when using Lit 2.x directives. I have created a small test repo: https://github.com/peschee/wds-esbuild-lit-test
I think this issue blocks users from upgrading to Lit 2.x when using TypeScript and the recommended esbuild setup in wds.