5
GitHub - niksy/babel-plugin-transform-globalthis: Babel plugin for transforming...
source link: https://github.com/niksy/babel-plugin-transform-globalthis
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
babel-plugin-transform-globalthis
Babel plugin for transforming
globalThis
.
Install
npm install babel-plugin-transform-globalthis --save-dev
Usage
Use it via available plugin activation options.
For .babelrc
file:
{ "plugins": ["babel-plugin-transform-globalthis"] }
Then, in your code:
/* Before */ globalThis.becky; /* After */ // Ommited for simplicity - here goes `globalThis` ponyfill var _globalThis = {}; _globalThis.becky;
Check test fixtures (actual and expected) for more examples.
Acknowledgments
License
MIT © Ivan Nikolić
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK