1.0.0 • Published 5 years ago
babel-plugin-transform-globalthis v1.0.0
babel-plugin-transform-globalthis
Babel plugin for transforming
globalThis.
Install
npm install babel-plugin-transform-globalthis --save-devUsage
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
- A horrifying globalThispolyfill in universal JavaScript by @mathias
- @ungap/global-thisby @WebReflection
License
MIT © Ivan Nikolić
1.0.0
5 years ago