Error while compiling: Unexpected token
kamilkisiela opened this issue · comments
Error while compiling:
Babel compiling files:
angular2-now.js
{ [SyntaxError: /packages/pbastowski_angular2-now/angular2-now.js: Unexpected to
ken (569:28)]
pos: 23785,
loc: { line: 569, column: 28 },
_babel: true,
codeFrame: ' 567 | \n 568 | // Custom data\n> 56
9 | data: options.data\n |
^\n 570 | };\n 571 | \n 572 | ' }
Startup error:
While processing files with pbastowski:angular-babel (for target
web.browser):
packages/pbastowski:angular2-now/angular2-now.js:569:28: Babel
transform error
I'm using:
angular@1.3.1
pbastowski:angular-babel@1.0.7
pbastowski:angular2-now@0.3.17
Could you please provide a link to a repo I can look at?
It's the private repo but I'm going to reproduce it in a moment.
I've made changes to your repo to make it work. There were quite a few changes, so, you'll want to read the commit logs to see what I did.
Please give me push rights to the demo repo on github and I will push my changes to it.
Ok, you can check now. There were few errors in app.js but the unexpected token error was right before them. So I didn't want to push new commits with fixes, thought it was unrelated.
Done. I hope this helps you.
In summary:
- removed babel.json, as it is not needed
- removed babel.rc as it's not needed
- removed mostly empty app.js in client folder
- moved app.js from root to client folder. client code in the root folder will cause errors unless wrapped in
Meteor.isClient()
- user
var
{} = angular2-now insteadconst
- added options to set
vm
as the default controller name - also importing
bootstrap
- using angular2-now@1.0.2, which is the correct version to use with Meteor 1.2 - this was the main reson for the "Unexpected token" error
- added "angular-meteor" dependency to SetModule:
SetModule('app', ['angular-meteor']);
- templateUrl must also specify the folder name "client/", as in
templateUrl: 'client/app.html'
@pbastowski Yeah, I build it as fast as I can so I didn't think about moving it to /client etc.
So basically, unexpected token error was caused by using not proper version of package? For Meteor 1.2+ I have to use angular2-now in version 1.0.0+?
Yes.
Any specific reason you added babel.json and babel.rc?
I think it is just a leftover. I was using your ecmascript-extra couple weeks ago.
OK, cool.
Closing the issue.
@pbastowski My app was working right, but then I updated packages below and got error:
pbastowski:angular-babel@1.0.6 to 1.0.7
angular@1.3.0 to 1.3.1
pbastowski:angular2-now@0.3.15 to 0.3.17 without changes
I will use angular2-now 1.0+ version so you can close issue.
Do you mean to say that meteor update
gives you "angular2-now@0.3.15" automatically?
I set @0.3.17 manually to one of my package
Why not use @1.0.2? Are you using Meteor 1.1?
I recently moved my app to Meteor 1.2. Ok, now I'm going to use @1.0.2.
Thanks for your help and angular2-now :)
You are welcome.