Skip to content

CJS support #7

Closed
Closed
@make-github-pseudonymous-again

Description

I found at least one offensive line here:

// Maybe a shaky assumption
// TODO: look at babel config to see whether it will output ESM/CJS or other formats
format: "module",

If I replace the format definition with format: /\.cjs$/.test(filename) ? "commonjs" : "module", it works for me so I assume something was overlooked here. This may not be the best way to handle this but at least it shows I can fix it to work for my use case.

If I do not do that, I get tons of errors similar to SyntaxError: The requested module '#foo' does not provide an export named bar when importing some commonjs module. I am also using @node-loader/import-maps so maybe there is some interdependence there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions