-
Notifications
You must be signed in to change notification settings - Fork 311
Version 0.0.29 Rollup parser error #107
Comments
Hello, thanks for opening an issue with us! Would you mind posting a repo i can use to reproduce this issue? Thanks! |
You can try it here: https://github.com/Kobzol/ionic-parser-tmp. |
So it appears like it has to do with async/await, but not sure why typescript would have an issue with that all of a sudden. We'll dig into it, thanks. |
I'm trying to narrow this down and think of where things can be differet. What version of typescript are you using? It seems like this way rollup/typescript doesn't have an issue with: But with this way it does have the parse issue: Do you have any clues why that might be? |
I'm using Typescript 2.0.3. Maybe the second expression is different/harder to parse because I'm awaiting an attribute of a call expression? Yet it worked without problems in 0.0.28 and before. |
In 0.0.28 it spawned a new But not sure what the difference would be. |
I'm not sure if it's true for this kind of usage, but I found a comment that states that using this API can hide some errors: microsoft/TypeScript#9017 (comment). |
I tried adding babel rollup plugin and with it it finally showed me where's the problem:
So I guess that TypeScript (when targeting ES6) transforms async to generator functions and Rollup doesn't understand them. That is weird, because rollup uses Acorn >= 4.0.0, which should understand them (it also did understand them in the 0.0.28). It seems to me that transpileModule produces incorrect code for async lambdas.
|
After removing async lambdas, the build works. I tried using a simple async lambda with transpileModule and it works. Isn't it possible that ionic somehow preprocesses the source files and messes up async lambds? Maybe in the typescript-helpers code? I even managed to get ES6>ES5 with async working on a device, but I had to modify some rollup plugins and the ngc/transpile build step to get it working, so a more official support would be nice. |
Yeah, I'm also having trouble with async fat arrow functions. There's no way to represent them in other ways, @Kobzol would you mind sharing how did you make it compile? |
Well it's certainly not an ideal way, but you can simply transform the async lambdas to async functions, so that's what I did. { fn: asyncFn }
async function asyncFn()
{
...
} |
Yeah, but that would break the feature of the fat arrow functions which is to capture the |
Indeed, that sucks. I only did it as a temporary solution to verify that the async lambdas are causing the problem. I hope that it will get resolved :-) |
The problem has been solved with 0.33, the development build now correctly parses the async lambdas. |
Short description of the problem:
When I upgraded to version 0.0.29, a weird parser error appears during dev build.
SyntaxError: Unexpected token (74:51) in C:/pg/Programovani/mobile/ionic2/strava5/src/app/app.component.ts at Parser.pp$4.raise (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:4070:13) at Parser.pp.unexpected (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:2268:8) at Parser.pp.expect (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:2262:26) at Parser.pp$1.parseBlock (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:2673:8) at Parser.pp$3.parseFunctionBody (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:3938:22) at Parser.pp$1.parseFunction (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:2764:8) at Parser.pp$3.parseExprAtom (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:3610:17) at Parser.pp$3.parseExprSubscripts (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:3492:19) at Parser.pp$3.parseMaybeUnary (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:3469:17) at Parser.pp$3.parseExprOps (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:3411:19) at Parser.pp$3.parseMaybeConditional (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:3394:19) at Parser.pp$3.parseMaybeAssign (C:\pg\Programovani\mobile\ionic2\strava5\node_modules\@ionic\app-scripts\node_modules\rollup\dist\rollup.js:3371:19)
The line in the TypeScript file that gives the error contains this:
() => this.session.isActive(),
the error shows location 74:51, but the line doesn't even have 51 columns, I checked it, there's no whitespace, so the error is pretty weird.
I also double checked that this didn't happen in 0.0.28 (I installed x.28, build was fine, then I removed x.28, installed x.29 or x.30 and the build fails with this).
Which @ionic/app-scripts version are you using?
0.0.29/30
The text was updated successfully, but these errors were encountered: