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

Babel 7 support #232

Closed
nickluger opened this issue Jun 23, 2018 · 6 comments
Closed

Babel 7 support #232

nickluger opened this issue Jun 23, 2018 · 6 comments

Comments

@nickluger
Copy link

This is a terrific library.
But, will it support Babel 7 again?
#220 (comment)

The problem is mainly with Next.js, used by many devs nowadays. Next.js moved to Babel 7. js-lingui is currently the only lib, blocking us from upgrading to Next v6.

Thank you for your effort and great work.

@tricoder42
Copy link
Contributor

Hey @nickluger,
thank you for your kind words!

Supporting both Babel 6 and 7 is challenging, but it's something we're gonna need to do anyway. I don't expect that everyone will update to Babel 7 as soon as it's released...

I'll start working on it. It basically needs to update release pipeline to support jsLingui 2.x and 3.x versions on npm in parallel... Pity that Babel 6/7 packages are distributed under different namespace, otherwise we could try to list them as peerDependencies.

Any suggestions how to handle this are welcome!

@disintegrator
Copy link

We are in the same position as @nickluger in that the updated to Next 6 has meant we are on babel 7 and were no longer able to run lingui extract (compile works fine).

To work around this we install the babel bridge package (https://github.com/babel/babel-bridge) and add this to our package.json:

"resolutions": {
  "babel-core": "^7.0.0-0"
}

resolutions is a yarn feature that forces request for a dependencies to use a specific version regardless of what other dependencies want (lingui wants ^6). This is considered dangerous since there is no guarantee your deps work with the resolutions you specified.

... anyways, applying this workaround worked for us and lingui extract worked once again.

@tricoder42 I think the transition for this project might be smooth if you follow the guidance in the babel bridge README.

@tricoder42
Copy link
Contributor

I haven't heard about babel-core bridge until yesterday. I'm gonna definitely look at it.

Also interesting that it's enough to add bridge fro babel-core even though @lingui/cli depends on several babel packages (babel-runtime, babel-generator, etc).

@tricoder42
Copy link
Contributor

I'm planning to setup Next.js project on my own soon, so this is definitely priority.

@gilamran
Copy link

gilamran commented Jul 6, 2018

With the help from @disintegrator!

  • Add this to your package.json
"resolutions": {
  "babel-core": "^7.0.0-0"
}
  • Add "babel-core": "7.0.0-bridge.0", to your dependencies in package.json
  • Delete your node_modules
  • Run yarn to reinstall everything (Will not work using npm)

@tricoder42
Copy link
Contributor

Fixed in latest release v2.3.0.

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

4 participants