I get what seems like a conflict in babel/register between two local npm packages.
In the package, I do the following:
require('babel/register'); require('index');
And in the index file of the same package:
require('test');
And in the "test" package:
require('babel/register'); require('test/index');
This causes the following error:
throw new Error("only one instance of babel/polyfill is allowed");
But if I take the string babel/register from the package "test", I get the following error in the index file of the package "test":
import fs from 'fs'; ^^^^^^ SyntaxError: Unexpected reserved word
I tried using System.import to import the “test” package (using the polyfill specified on the BabelJS website), but in this context I get the same error as above. How should I import one package into another and retain the ability to use ES6 import / export and other ES6 features?
EDIT: I simplified this a bit, I still need a “test” in the first package, but I don’t upload the mediation file. Instead, the "main" file "test" is set to test/index. Theoretically, now it just loads one ES6 module, which it should be able to register. I am still getting the above error.
source share