Only one instance of babel/polyfill is allowed

Hello guys,

currently, I work for a school project and want to show some charts with angularJs and meteor.

I want to use the ui-router plugin. But when I try to use it, I get the following error:

Error: only one instance of babel/polyfill is allowed
at Object.eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:397:22), <anonymous>:2872:9)
at Object.1.180 (eval at <anonymous> (http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:397:22), <anonymous>:2875:4)
at s (eval at <anonymous> (http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:397:22), <anonymous>:2863:254)
at e (eval at <anonymous> (http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:397:22), <anonymous>:2863:425)
at eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:397:22), <anonymous>:2863:443)
at eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:397:22), <anonymous>:7043:4)
at eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:397:22), <anonymous>:7050:3)
at eval (<anonymous>)
at http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:397:22
at Function.globalEval (http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:398:7) <div ui-view="" class="ng-scope" data-ng-animate="1">

Also I get this warning:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

This is my main.html:


class Main {}

const name = 'main';

// create a module
export default angular.module(name, [
angularMeteor,
uiRouter,
Navigation,
Toolbar,
View2,
View1,
ngMaterial
]).component(name, {
template,
controllerAs: name,
controller: Main
})
.config(config);
function config($mdThemingProvider,$urlRouterProvider,$stateProvider ) {
'ngInject';


$urlRouterProvider.otherwise('view1');

$stateProvider
    .state('view1', {
        url: '/',
        templateUrl: 'test.html'
    });

$mdThemingProvider
    .theme('default')
    .primaryPalette('orange')
    .accentPalette('deep-orange')
    .warnPalette('red');
}

And this is the code of my main.html where the view should be injected:

<div layout="column" style="height: 100%">
<toolbar scroll></toolbar>
<section layout="row" flex>

    <navigation></navigation>

    <md-content flex layout-padding style="margin-top: 75px">
<div ui-view=""></div>
    </md-content>
</section>

Without ui-router it works fine! I also tried the original angular-route plugin and got the same error.

What is the problem here?

1 Like

Is this question too complicate? Is the solution unknown? Or do you need additional information? Am I at the wrong place?

Please someone answer me :frowning: .

1 Like

I found the solution.

Something was wrong with the $stateprovider.

I copied this code

$stateProvider
.state('view1', {
    url: '/',
    templateUrl: 'test.html'
});

into the view and changed it to this:

function config($stateProvider) {
'ngInject';
$stateProvider
    .state('view1', {
        url: '/view1',
        template: '<view1></view1>'
    });
}

(Last code example is already the finished code from my project). So no more templateUrl, but template now.

I have REALLY no idea why this works, but it works. Maybe there is someone who can explain this?