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.

Document how babel-plugin-transform-runtime changes references to builtins as a pitfall

See original GitHub issue

I am trying to use reflection and Typescript decorators. My library uses the reflect-metadata polyfill. The babel-plugin-transform-runtime plugin is clobbering the references to Reflect in my test files, resulting in two reflection registries and thus breaking reflection between my library and the test file. I am unable to test decorators from my library. I made a simple repo to illustrate the issue: https://github.com/dwieeb/ava-decorators

I had to use ava from master in order to debug tests in subprocesses and ultimately see that babel is wiping out the global Reflect and also substituting my polyfill for some core-js thing.

node 6 npm 3

relevant, unresolved: https://github.com/avajs/ava/issues/947

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
novemberborncommented, Jan 20, 2017

As of #1197 master no longer applies the runtime transform.

2reactions
imhoffdcommented, Jan 7, 2017

@lholznagel I did this, but I think const { Reflect } = global should work, too(?):

const g = <any>global;
const Reflect = g.Reflect;
Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/plugin-transform-runtime
A plugin that enables the re-use of Babel's injected helper code to save on codesize.
Read more >
@babel/plugin-transform-runtime - npm
Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals.
Read more >
@babel/plugin-transform-runtime | Yarn - Package Manager
@babel/plugin-transform-runtime ... Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals. babel- ...
Read more >
babel-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Advanced Features: Customizing Babel Config - Next.js
But if you want to extend the default Babel configs, it's also possible. To start, you only need to define a .babelrc file...
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