swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.78k stars 75 forks source link

feat: update esm module resolver #781

Closed yeliex closed 3 months ago

yeliex commented 4 months ago

This PR as a continuation of #727 and #767

  1. almost full rewrite the esm resolver, fallback to use node resolver if ts resolve unexpected. this supports js files with d.ts files the same time
  2. trying to guess module format for absolute file import, supports absolute import like mocha

relate: #727 #754 #766 #767 #777

fix #779

yeliex commented 4 months ago

@Brooooooklyn please take a look

it is better to build a new test tool to test module resolve and import, like what ts-node does. there are so many edge cases for resolvers, and hard to test all cases by a single module.

gastonsilva commented 3 months ago

@yeliex is there an ETA for this or #777 to get into a new release? I'm stuck with #774 and would like evaluate if I should wait or use a workaround Thanks!!! (keep the great work :heart:)

yeliex commented 3 months ago

@gastonsilva waiting for @Brooooooklyn to review this, you can try to install from git temporarily, and if there are any issues, i can fix them before release

martinslota commented 3 months ago

This also fixes https://github.com/swc-project/swc-node/issues/784! 😍

yeliex commented 3 months ago

@Brooooooklyn or maybe we should re-commit this PR to master?