Wrong scope when transpile to System.register?
RobertCZ opened this issue · comments
RobertCZ commented
Trying to transpile something like
class C {}
export function factory() {
return new C()
}
with minimal config
transpiler: 'plugin-babel',
meta: {
'*.js': {
babelOptions: {
es2015: false,
},
},
},
and getting ReferenceError: C is not defined because it's transpiled to
(function(System, SystemJS) {System.register([], function (_export, _context) {
"use strict";
function factory() {
return new C();
}
_export("factory", factory);
return {
setters: [],
execute: function () {
class C {}
}
};
});
})(System, System);
So scope for class C is wrong. Any way to fix/workaround it? Thanks
Guy Bedford commented
This should be fixed in the latest Babel releases. An update to this plugin for newer Babel builds can be made.