-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
ParseError: 'import' and 'export' may appear only with 'sourceType: module' #157
Comments
You upgraded to babelify 7.0, which uses the new babel 6.0, and you're missing options. Please read the README. |
Totally appreciate the help @zertosh. |
@sent1nel : Please share solution! Same issue and don't see what option we are missing. Appreciated!!! |
I too am seeing this problem after updating to Babel 6. @zertosh you have said See README in several answers to this, but yet I cant find anything in the README that specifically states which options we need to provide to avoid this issue. Can you update the README there and put something like NOTE: If you are seeing this error (...) this is why and here is how to solve it. All the searches I am seeing on google indicate some option is not sent to Babel 6, yet at least from what I have found so far, my webpack includes the es2015, react and state-1/23 options in the loader section of my webpack. I am also including all the correct dependencies in my package.json file. So any pointers to what we need to do would be of HUGE help to many of us that have this problem. Also, what README are you referring to? I looked through the page about migrating from Babel 5 to Babel 6... maybe I am looking at the wrong README? |
If people open new issues with their current configurations and what features they want, I'd be more than happy to tell them what's missing. I don't know how else to help. |
This is what I needed to do to fix this error:
|
MFW people say RTFM and they think they are helping just because some people randomly solve their problems alone after they read the insult. |
Sorry @gaboom, that was sarcasm. A colleague of mine fixed this by using preset es2015, the README doesn't contain an upgrade guide. |
Thanks for this @baptistebriel I updated and have been having this issue all night! |
If you are using react-native, I've got this error after init a new project and it was due to the defaults included packages (maybe I've finally removed my |
Adding |
@baptistebriel: I think you can use either the browserify config in package.json or pass the config in the browserify transform. I don't think you don't need both (at least I didn't). |
I am getting this error simply by changing preset from es2015 to es2016. Why should that break this? Instead of a bunch of "works for me with this tweak", there shoudl be compatibility. Here are my deps: and my build cmd: |
@drewdeal There is no reason to expect that es2016 will be as complete as transform as es2015. In fact, what I suspect is happening is that some part is missing. You will have to look into both presets and check the differences I am afraid. People can help if you maybe can give a minimal source code example for your index.js file that has just the couple lines that are required for the error to show. |
|
Thanks @ashnur and @loganfsmyth . Since I am writing an app for Chrome only, I figured out that the better route was to go with this that works perfectly for me: I am new to babel, so it took me a while to understand that the es2015 preset transforms code back to ES5. My first assumption was that it should 'out' to es2015. So once I got that, I figured es2016 would cleanly work and take me to es2015, preserving arrow functions, spreads, etc. I am still surprised my code would be in context to the bug however, since the error itself does not point to any line in my code other than this generic sourseType one. |
For browserify users that are running into this issue: • It is likely that this issue is getting triggered because you're importing "build": "browserify src/main.js -o assets/bundle.js -t [ babelify --global ] && (say 'go es!'; echo 'built!')", • I also converted my Hope it helps someone! (Commenting here since this issue is one of the top results for the query) |
Hello,
I updated babelify to 7.0.2 and now it throws this error:
Working with 6.4.0.
Do you maybe have any ideas?
Thanks!
The text was updated successfully, but these errors were encountered: