Skip to content

Doesn't work when passing a specific file #12

Description

@thislooksfun

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions