chird / meteoJS

Javascript Library for meteorological and atmospheric tools
Apache License 2.0
27 stars 6 forks source link

Cannot use import statement outside a module Error on node 18 #81

Open masterfabela opened 1 month ago

masterfabela commented 1 month ago

When I try to import this package in Node, I encounter an error that seems to originate from an internal import within the package.

(node:18) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/projects/node-99aw1w/node_modules/meteojs/index.js:40
import 'regenerator-runtime/runtime.js';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (https://node99aw1w-3gkv.w-credentialless-staticblitz.com/builtins.5bf3667c.js:266:849)
    at wrapSafe (https://node99aw1w-3gkv.w-credentialless-staticblitz.com/builtins.5bf3667c.js:144:13497)
    at Module._compile (https://node99aw1w-3gkv.w-credentialless-staticblitz.com/builtins.5bf3667c.js:144:13881)
    at Module._extensions..js (https://node99aw1w-3gkv.w-credentialless-staticblitz.com/builtins.5bf3667c.js:144:14855)
    at Module.load (https://node99aw1w-3gkv.w-credentialless-staticblitz.com/builtins.5bf3667c.js:144:12820)
    at Module._load (https://node99aw1w-3gkv.w-credentialless-staticblitz.com/builtins.5bf3667c.js:144:10273)

Node.js 18.20.3

I have created a demo where this issue can be reproduced:

https://stackblitz.com/edit/node-lvdcei?file=index.js