Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

[Node.js 12] Does not work with "type": "module" in "package.json" #789

@cedx

Description

@cedx

I'm using the new ES modules features from Node.js 12 (the next LTS).

If I set my package to be an ESM one with the field type set to module in package.json file, the esm package stops working as expected.

import {spawn} from 'child_process';
       ^
SyntaxError: Unexpected token {

If I set the type field to commonjs, esm works as expected (but not my code which uses only ES modules).
It would be nice if esm could manage this case (i.e. that the new ESM parser is already enabled).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions