swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.68k stars 67 forks source link

Regression: `@swc-node/register@1.8.0` doesn't handle default exports properly #752

Open mitchhentgesspotify opened 5 months ago

mitchhentgesspotify commented 5 months ago

To reproduce

See this reproduce repo I made for you

Details

Before, doing import fs from 'fs-extra' would indeed get you the fs module. Now, fs is undefined (though import { nonDefaultExport } from 'example-package' still appears to work).

I don't know how exactly "default" imports work with .cjs, so I'm not sure what the specific issue is here.

Workaround

Use @swc-node/register@1.6.8