Document how babel-plugin-transform-runtime changes references to builtins as a pitfall
See original GitHub issueI 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:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As of #1197
master
no longer applies the runtime transform.@lholznagel I did this, but I think
const { Reflect } = global
should work, too(?):