question-mark
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 honor .babelrc

See original GitHub issue

babel-watch does not seem to honor my .babelrc

Currently:

{
  "presets": ["latest", "react", "stage-0"],
  "plugins": ["transform-decorators-legacy"]
}

Running my code with babel-watch and this error is thrown: regeneratorRuntime is not defined While babel-node I am good to go

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kmagieracommented, Oct 7, 2016

@larron Thanks to your example code I managed to get that issue reproed.

It appears that babel-node automatically imports babel-polyfill for every process it runs. In my opinion this may lead to confusion as whenever you run your code with babel-node it will work fine, but when you want to run it in production it is recommended to build it first and then run with regular node. In which case you’ll end up getting the same error as you have here.

Now I believe that the proper solution is what @jadsonlourenco suggested and I no longer consider it to be a workaround. I’ve also found an alternative solution which makes babel add babel-polyfill in the transpilation step and you don’t need to add it manually:

npm install --save-dev babel-plugin-transform-runtime babel-runtime

Then add this to your .babelrc plugin section:

{
  "plugins": [
    ["transform-runtime", {
      "polyfill": false,
      "regenerator": true
    }]
  ]
}

I’m closing this issue, and will update troubleshooting section on the main page with information about this issue.

Thanks everyone for participating in the discussion

2reactions
jadsonlourencocommented, Oct 1, 2016

Try: npm i babel-polyfill --save-dev, then add import 'babel-polyfill' to your main.js file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Root .babelrc not being read · Issue #13577 - GitHub
I expect storybook to honor my .babelrc file at the project root level. Screenshots Notice the pink background when .babelrc is in .storybook...
Read more >
Make babel exclude test files - node.js - Stack Overflow
I've edited the answer...it seems that the .bablerc ignore is not honored. I've noticed several variations of this being reported on their ...
Read more >
Configure Babel
How Babel merges config items. Babel's configuration merging is relatively straightforward. Options will overwrite existing options when they are present and ...
Read more >
Babel 7 Released
After almost 2 years, 4k commits, over 50 pre-releases, and a lot of help we are excited to announce the release of Babel...
Read more >
Config Files - Babel.js
The primary downside of this project-wide config is that, because it relies on the working directory, it can be more painful to use...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found