4 ms·
If you are on an older version of node and want ESM, but don’t want to use .mjs, you can try: https://www.npmjs.com/package/esm https://www.npmjs.com/package/e
by runawaybottle 6y ago
If you are on an older version of node and want ESM, but don’t want to use .mjs, you can try:
https://www.npmjs.com/package/esm https://www.npmjs.com/package/esm
The package.json should have something like this if they are going to use import/export statements so anyone on older versions don’t have to worry about it (it’s not native to Node yet without .mjs extension).
We can blame whoever didn’t set that up, or the instructions should have been to just use require().
- ravenstine 6y ago> it’s not native to Node yet without .mjs extension Since v13, you can use ES modules without the .mjs extension if the nearest package.json includes `"type": "module"`.
- runawaybottle 6y agoThank you, that’s good to know.