question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[dev-server-esbuild] Unable to resolve packages with correct extensions when imported in an .ts file using node's `exports`

See original GitHub issue

When 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:18 (13 by maintainers)

github_iconTop GitHub Comments

7reactions
pescheecommented, May 3, 2021

@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

6reactions
pescheecommented, May 4, 2021

I think this issue blocks users from upgrading to Lit 2.x when using TypeScript and the recommended esbuild setup in wds.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found