-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Babel 7 "SyntaxError: Unexpected token import" in lerna environment #7208
Comments
Hey @Raigen! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
You need to tweak your |
First of all, thank you for the fast answer! I tweaked around with
Or maybe the reporter just follows linked files, that I do not know. But someone is following here. I could not ignore it from the What actually worked was When I just ignore
Obviously there is a I could not really figure out where babel 7 looks for my packages, so I do not really know how to most efficently In the end technically the question is answered, thanks to the help I figured out a pattern that works for me
I might even be able to use But I do not really understand the way this workes, what bothers me. I do not like to use parameters that I can not understand. This always leads to errors and then you have to ask again. Also I can not get this working with |
I´m having the same problem. My Lerna packages are the same except that all my code resides inside a
In my case Lerna is using yarn:
I´m using babel@7.0.0-beta.42 Any ideas on how to solve it ? |
I solved it using |
@Raigen, |
I'm having this issue as well. No issue if I put the config into my I have a workaround for webpack, but I can't find a workaround for running Electron without Register works fine on Windows 7 x64, but not at all on Linux Mint 17.3 x64. All versions are at Any ideas on a fix or workaround would be greatly appreciated. |
@slapbox Please check out jestjs/jest#6053 (comment). That is likely your issue. This is a new change and isn't really documented yet. |
Holy crap that was fast. Thanks very much for your help. I was just coming back to report I was mistaken and register doesn't work on Windows 7 on |
Closing as resolved |
We use lerna to seperate concernes into multiple packages. One of them is depending on two others to combine them in the final build. For production we build them independently and then put the dependencies into the
node_modules
directory of the first package.In development we do nothing special because babel-node from the first package seems to take care of the
import
statements also from the other packages.After I updated to babel 7 for testing purpose babel does not transform the other packages anymore.
I created two repositories with a minimal reproducer of the environment, one with babel6 where the
import
works and one with babel 7 dependencies where it does not work anymore.Using
@babel/register
here https://github.com/Raigen/babel7-tmp/blob/master/packages/pck2/index.js#L4 does not work either.I am out of ideas right now. I expect this to work because babel itself is a monorepo with lerna and
import
-dependencies inside./packages
. But I can not get it to work even in the simple reproducer repos I created.Input Code
https://github.com/Raigen/babel6-tmp
https://github.com/Raigen/babel7-tmp
Expected Behavior
https://github.com/Raigen/babel6-tmp
Current Behavior
https://github.com/Raigen/babel7-tmp
Context
We plan to refactor one of our packages with typescript. For this purpose we need to figure out how the development environment can work with one package on typescript and the other packages still on babel. And the best idea until now is to keep babel everywhere and move to babel 7 with the typescript preset. This does work for all packages running independently and in the build, but not when I try to run the one package that
import
s from the others.Also we of course want to keep our dependencies updated, so even without typescript we would want to upgrade to babel 7 when it is final.
Your Environment
The text was updated successfully, but these errors were encountered: