Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not work with Babel 7 beta

See original GitHub issue
  • babel-macros version: 1.2.0
  • babel-preset-env: 7.0.0-beta.3
  • node version: 8.6.0
  • npm (or yarn) version: 5.3.0

Relevant code or config

Simple index.js

const test = preval`module.exports = 1`;



  "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 (<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 (<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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

kentcdoddscommented, Jul 16, 2018

You may need to install babel-core@7. Look at the jest documentation. It explains how to make it work with babel 7.

kentcdoddscommented, Dec 10, 2017

Alrighty, babel-plugin-macros has been published and we’re now testing with babel-core @ 7

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade to Babel 7
This just means Babel itself won't run on older versions of Node. It can still output code that runs on old Node versions....
Read more >
Jest with Babel ^7.0.0-beta.51 issue - Stack Overflow
I followed everything you recommended me to make the Babel 7 work with the Jest. I installed the @babel/core and babel-core . Still...
Read more >
babel-loader - npm
This package allows transpiling JavaScript files using Babel and webpack. Note: Issues with the output should be reported on the Babel ...
Read more >
babel/polyfill (Babel 7 beta) causes a SyntaxError-babel.js
More Query from same tag · React native 0.57 build issues. · Syntax doubling with . · How Babel transpiles the rest/spread operator...
Read more >
Babel 6 and early betas of Babel 7 do not have assertVersion , so this wrapper ensures that it exists and throws a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found