Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work when passing a specific file #12

Open
thislooksfun opened this issue Jan 6, 2023 · 0 comments
Open

Doesn't work when passing a specific file #12

thislooksfun opened this issue Jan 6, 2023 · 0 comments

Comments

@thislooksfun
Copy link

When I give the program a specific file it crashes with the error

TypeError: traverse is not a function
    at replaceImportWithDummy (node_modules/treeche-core/lib/replaceImportWithDummy/mod.js:9:5)

Looking into it, the problem is that @babel/traverse and @babel/generator are both CommonJS modules that export an object with __esModule: true and a default key, which Node's native ESM importer treats as a single export default {default: <value> }, rather than splitting it into default and named imports. The fix is pretty simple, you need to either transpile into CJS with esModuleInterop: true, or you need to manually unwrap the default key when using those imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant