Skip to content
This repository has been 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

Closed
cedx opened this issue Apr 27, 2019 · 2 comments
Closed

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

cedx opened this issue Apr 27, 2019 · 2 comments

Comments

@cedx
Copy link

cedx commented Apr 27, 2019

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).

@dnalborczyk
Copy link
Contributor

hey @cedx this is related to #784 and should be fixed with the next release.

@cedx
Copy link
Author

cedx commented Apr 27, 2019

OK, closing as probable duplicate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants