-
Notifications
You must be signed in to change notification settings - Fork 135
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
Does not work with Babel 7 beta #41
Comments
Hi @nicmosc, thanks for filing the issue. Hmmm... Your const preval = require('preval.macro');
const test = preval`module.exports = 1`;
console.log(test); |
Also, that error is not coming from babel-macros... It's coming from |
Hi @kentcdodds I made a test repo with some code to show the errors, you can find it here: https://github.com/larsbs/babel-macros-test I had to do some "hacks" in order to make it run the code. First, if you try to use One final note, if you run the same code but using babel@6 it's gonna work without issues so it probably it's related to a change in babel-plugins api or something like that. |
Well that's super odd. Probably a bug with babel@7 or some breaking change like you said @larsbs. Thanks for bringing this up @nicmosc! cc @loganfsmyth, @hzoo :) |
This is because |
Ah, that's unfortunate. Thanks for the tip @loganfsmyth! What do you suggest in this scenario? Should I move babel to a peerDependency of preval? |
@kentcdodds The transition to 7.x is gonna be a little bumpy for people with more complicated plugins like this one. A peerDep is the way to go. In 7.x we've moving all of Babel's plugins to have peerDeps on Also to the point above mentioned in
You may want to rename this to have an |
I'll see if I can get Thanks again @loganfsmyth! |
Oh actually! You may have one option to avoid the peerDep mess for now, though I don't know if your API exposes it? The Still better to have the peerDep in the long run, but at least then you could transition to it in a future major version when you actually want to drop 6.x support. |
Thanks. I'd considered doing that, but went with requiring babel-core to make it easier (so I don't have to pass |
As an update, @xjlim refactored out |
I just tried the new |
Thanks! |
FYI I'm using Babel 7 for everything in |
Perhaps. But I'll keep this open until I official change it to babel-plugin-macros (which I did get publish rights to by the way). 👍 Hopefully this will happen soon |
Closes #41 BREAKING CHANGE: upgrades to babel v7
Closes #41 BREAKING CHANGE: upgrades to babel v7 and renames to babel-plugin-macros
Closes #41 BREAKING CHANGE: renamed to babel-plugin-macros
Alrighty, |
So how did you fix this one? 😄 |
I have following dev dependencies:
and I couldn't make the babel thing work with jest because of:
|
You may need to install |
babel-macros
version: 1.2.0babel-preset-env
: 7.0.0-beta.3node
version: 8.6.0npm
(oryarn
) version: 5.3.0Relevant code or config
Simple
index.js
.babelrc
What you did:
Ran
yarn babel index.js
.What happened:
Log:
Problem description:
It seems that
babel-macros
does not play well with the latest beta version of Babel 7. A bit of a shame since I'd like to use macros to solve another issue caused by Babel 7 with some older code.A similar error is triggered when using
babel-preset-react
:Suggested solution: None for now
The text was updated successfully, but these errors were encountered: