ts-node icon indicating copy to clipboard operation
ts-node copied to clipboard

[ESM] [SWC] SyntaxError: The requested module '' does not provide an export named ''

Open carlosmiei opened this issue 1 year ago • 6 comments

Search Terms

esm,swc, interfaces

Expected Behavior

When exporting an interface, the ts-node crashes, however, this only happens when we provide --swc option.

Actual Behavior

Crashes with the error: SyntaxError: The requested module './.js' does not provide an export named ''

Steps to reproduce the problem

  • Create fileA.ts and export an interface there
  • Create fileB.ts and import and export the interface from fileA.ts

Minimal reproduction

  • FileA
export interface myType {
    id: string;
}
  • FileB
import { myType } from "./types.js";
export { myType } from "./types.js";
console.log("Hello World!");

Specifications

  • ts-node version: v10.9.1
  • node version: v18.14.0
  • TypeScript version: 4.7.4
  • tsconfig.json, if you're using one:
{}
  • package.json:
{}
  • Operating system and version:
  • If Windows, are you using WSL or WSL2?:

carlosmiei avatar Mar 16 '23 18:03 carlosmiei

Running into this issue as well, the weird thing is the same import path could work in 1 file but not in another file

AChangXD avatar Apr 05 '23 02:04 AChangXD

Happens to me to. Typescript has no issue, interface being exported but NOT using swc. Also happens with export type instead of interface though.

matthiasg avatar May 25 '23 06:05 matthiasg

Hello, is there any update on this issue? I'm running into the same error.

jholm117 avatar Sep 07 '23 16:09 jholm117

Same here.

nazarhussain avatar Sep 18 '23 17:09 nazarhussain

Same here +1

liSong5713 avatar Sep 21 '23 02:09 liSong5713

Hello. Any update on this issue please?

XavierBoubert avatar Oct 13 '23 12:10 XavierBoubert