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).
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 tomodule
inpackage.json
file, theesm
package stops working as expected.If I set the
type
field tocommonjs
,esm
works as expected (but not my code which uses only ES modules). It would be nice ifesm
could manage this case (i.e. that the new ESM parser is already enabled).