-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
When using import in any .js file #25792
Comments
Basically, when using any ES6 syntax. I tried using |
Make sure that
Example: |
another way to use https://babeljs.io/docs/en/babel-node after adding to your |
That was part of the problem. My extensions were |
I have babel code installed as global. Dunno why it raised this error in the first place. Ironically when working with React it doesn't happen at all :/ |
Sent from Yahoo Mail on Android
On Thu, Jan 31, 2019 at 1:37 AM, loox37<notifications@github.com> wrote:
Make sure that
- Node.js is started using --experimental-modules flag
- Script extension is .mjs
Example: node --experimental-modules script.mjs
That was part of the problem. My extensions were .js only.
Thanks man.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I think you used it in the wrong way |
Do I need to require the |
Hey @loox37 |
Having babel installed will not make Node use babel automatically. You need to be explicit. |
Thanks for all of you. Thank you!! |
Node version: v8.11.1
When using
const something = require('lib)
everything works fine. But when usingimport something from 'lib'
it shows this:I don't know what's wrong, or if I'm doing anything wrong :/
Thanks anyways for any help :)
The text was updated successfully, but these errors were encountered: