Package Exports
- babel-plugin-transform-global-system-wrapper
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-transform-global-system-wrapper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
babel-plugin-transform-global-system-wrapper
Converts global scripts into named System.registerDynamic('name', [], ...
Example
In
foo = "bar";Out
System.registerDynamic("foo", [], false, function ($__require, $__exports, $__module) {
var _retrieveGlobal = System.registry.get("@@global-helpers").prepareGlobal($__module.id, "foo", null);
(function ($__global) {
foo = "bar";
})(this);
return _retrieveGlobal();
});Installation
$ npm install babel-plugin-transform-global-system-wrapperUsage
Via .babelrc
.babelrc
{
"plugins": [
["transform-global-system-wrapper", {
"deps": ["baz.js"],
"exportName": "foo",
"globals": {
"jquery": "jquery.js"
},
"moduleName": "foo",
"systemGlobal": "SystemJS"
}]
]
}Via CLI
$ babel --plugins transform-global-system-wrapper script.jsVia Node API (Recommended)
require("babel-core").transform("code", {
plugins: [
["transform-global-system-wrapper", {
deps: ["baz.js"],
exportName: "foo",
globals: {
"jquery": "jquery.js"
},
moduleName: "foo",
systemGlobal: "SystemJS",
esModule: true
}]
]
});