Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Wrong scope when transpile to System.register? #88

Open
RobertCZ opened this issue May 29, 2018 · 1 comment
Open

Wrong scope when transpile to System.register? #88

RobertCZ opened this issue May 29, 2018 · 1 comment

Comments

@RobertCZ
Copy link

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

@guybedford
Copy link
Member

This should be fixed in the latest Babel releases. An update to this plugin for newer Babel builds can be made.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants