Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token const #560

Closed
deniss-muhla opened this issue May 30, 2017 · 2 comments
Closed

SyntaxError: Unexpected token const #560

deniss-muhla opened this issue May 30, 2017 · 2 comments
Labels
bug Confirmed bug

Comments

@deniss-muhla
Copy link

deniss-muhla commented May 30, 2017

We have unfinished generator function with unused variables:

function* updateTemplate() {
    try {
        while(true) {
            const {
                type,
                userId
            } = yield take(actions.UPDATE_TEMPLATE);

            const {
                response,
                error
            } = yield call(postTemplate, 'update', userId);
        }
    } catch(e) {
        if (e.name !== 'SagaCancellationException') {
            console.log(e);
        }
    }
}

Which was transformed into this with babili options { mangle: false }:

function*updateTemplate(){try{for(;;)const{type,userId}=yield(0,_effects.take)(actions.UPDATE_TEMPLATE),{response,error}=yield(0,_effects.call)(postTemplate,'update',userId)}catch(e){'SagaCancellationException'!==e.name&&console.log(e)}}

For loop scope curly brackets was removed and we getting node.js error:
SyntaxError: Unexpected token const

@deniss-muhla
Copy link
Author

Added { mergeVars: false } to babili option as temporary solution.

@vigneshshanmugam vigneshshanmugam added the bug Confirmed bug label May 30, 2017
@vigneshshanmugam
Copy link
Member

bug in simplify plugin

boopathi added a commit that referenced this issue Jul 8, 2017
boopathi added a commit that referenced this issue Jul 8, 2017
* Fix block removal during early continue transform

+ Fix #560

* Fix test suite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants