Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
masterfabela opened this issue Jul 13, 2024 · 1 comment
Open

Comments

@masterfabela
Copy link

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

@chird
Copy link
Owner

chird commented Sep 9, 2024

Sorry for my late replay. index.js is basically used to procude a simple-to-integrate meteojs.min.js for HTML-Pages. E.g. I use this file in my examples. For usage with nodeJS, please import the individual files with its classes directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants