pbastowski / angular-meteor-babel

Babel 5 ES6 transpiler for angular-meteor (includes ng-annotate)
11 stars 4 forks source link

The package pbastowski:angular-bable may not be compatible with meteor 1.4 #30

Closed eon-duplessis closed 8 years ago

eon-duplessis commented 8 years ago

Hello.

I have detected an error in my application using meteor 1.4 and your package.

modules.js?hash=aad6928…:14609 Error: only one instance of babel/polyfill is allowed at Object.eval (eval at <anonymous> (jquery.js:339), <anonymous>:2872:9) at Object.1.180 (eval at <anonymous> (jquery.js:339), <anonymous>:2875:4) at s (eval at <anonymous> (jquery.js:339), <anonymous>:2863:254) at e (eval at <anonymous> (jquery.js:339), <anonymous>:2863:425) at eval (eval at <anonymous> (jquery.js:339), <anonymous>:2863:443) at eval (eval at <anonymous> (jquery.js:339), <anonymous>:7043:4) at eval (eval at <anonymous> (jquery.js:339), <anonymous>:7050:3) at jquery.js:339 at Function.globalEval (jquery.js:340) at text script (jquery.js:9766)

I tried this on a new meteor project, starting off with the following configuration:


meteor create myproject
cd my project

meteor remove blaze-html templates
meteor remove ecmascript

meteor npm install --save angular angular-meteor

meteor add angular-templates
meteor add pbastowski:angular-babel

meteor

I have replaced my server.js with some basic code to populate a collection in MongoDb, and made the collection available to both server and client.

in my client folder:

main.js


import angular from 'angular';
import angularMeteor from 'angular-meteor';

angular.module('myApp', [
    angularMeteor
]).component('classCollection', {
    templateUrl: 'classesList.html',
    controllerAs: 'classCollection',
    controller($scope, $reactive){
     'ngInject';

     $reactive(this).attach($scope);

     this.helpers({
         classes(){
             return Classes.find({});
         }
     });
    }
});

classesList.html

<ul>
    <li ng-repeat="job in classCollection.classes">
        {{class.name}}
        <p>{{class.role}}</p>
    </li>
</ul>

index.html

<body ng-app="myApp">
    <class-collection></class-collection>
</body>

The error above still appeared. Could you advise me on what the problem is and why it seems to load more than one instance of babel please?

pbastowski commented 8 years ago

@Algahzor Can you please post a link to your repo and I will have a look at it for you? As it stands, I am not able to reproduce the error you mentioned above. It's probably a clash with another package in your project and that's why I need to see your actual project.

At the very least please post here the contents of the following files:

pbastowski commented 8 years ago

@Algahzor I just noticed that you have an error in the example above in the meteor remove statement

meteor remove blaze-html templates

should be

meteor remove blaze-html-templates

If the code you supplied in your example was exactly what you did, then you would indeed have a problem, because blaze-html-templates would not have been removed, which would result in a Meteor error. However, it would not explain the problem with the polyfill message.

Are you, perhaps, using a Windows machine for this project?