babel-plugin-macros: Does not work with Babel 7 beta
babel-macros
version: 1.2.0babel-preset-env
: 7.0.0-beta.3node
version: 8.6.0npm
(oryarn
) version: 5.3.0
Relevant code or config
Simple index.js
const test = preval`module.exports = 1`;
console.log(test);
.babelrc
{
"presets": [ "env" ],
"plugins": ["babel-macros"]
}
What you did:
Ran yarn babel index.js
.
What happened: Log:
TypeError: Cannot read property 'loose' of undefined (While processing preset: "/Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-preset-env/lib/index.js")
at _default (/Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-plugin-transform-es2015-modules-commonjs/lib/index.js:15:22)
at Function.memoisePluginContainer (/Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:113:13)
at Function.normalisePlugin (/Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:146:32)
at /Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
at Array.map (<anonymous>)
at Function.normalisePlugins (/Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
at OptionManager.mergeOptions (/Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
at /Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
at /Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
at Array.map (<anonymous>)
error Command failed with exit code 1.
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
:
TypeError: Cannot read property 'pragma' of undefined (While processing preset: "/Users/nick/Documents/Drawbotics/repos/platform-ff/node_modules/babel-preset-react/lib/index.js")
Suggested solution: None for now
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (12 by maintainers)
Commits related to this issue
- feat(rename): rename the project to babel-plugin-macros Closes #41 — committed to kentcdodds/babel-plugin-macros by deleted user 7 years ago
- feat(rename): rename the project to babel-plugin-macros Closes #41 BREAKING CHANGE: upgrades to babel v7 — committed to kentcdodds/babel-plugin-macros by deleted user 7 years ago
- feat(rename): rename the project to babel-plugin-macros Closes #41 BREAKING CHANGE: upgrades to babel v7 and renames to babel-plugin-macros — committed to kentcdodds/babel-plugin-macros by deleted user 7 years ago
- feat(rename): rename the project to babel-plugin-macros (#42) Closes #41 BREAKING CHANGE: renamed to babel-plugin-macros — committed to kentcdodds/babel-plugin-macros by deleted user 7 years ago
You may need to install
babel-core@7
. Look at the jest documentation. It explains how to make it work with babel 7.Alrighty,
babel-plugin-macros
has been published and we’re now testing with babel-core @ 7Perhaps. 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
Thanks!
preval.macro
has a generous version range I think so it should automatically update.