-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
invalid block directive in minify-dead-code-elimination #601
Comments
Just wondering about the corner case, Can you give the test code where it got failed? |
Looks like a bug. Would you like to send a PR? |
@vigneshshanmugam not easily, code base is >40k LOC and couldn't yet determine which part triggers it. I've noticed though that the block in question has an empty body, so guess this is caused by a previous optimization step (
So proposing a better fix based on that finding: function getUseStrictDirectives(block) {
return block.body && block.body.length ?
block.get("directives").filter(function (directive) {
return directive.node.value.value === useStrict;
}) : [];
} @boopathi sure, should this be based on master? |
@postspectacular Thanks for explaining. Yes based on master. |
@vigneshshanmugam no prob, still i think the real issue is somewhere else (in babel?) which causes |
I'm still getting this error. Running babel-preset-babili |
Just encountered this error (w/
babel-plugin-minify-dead-code-elimination@0.1.7
):I've added some debug traces and it seems that
block.get("directives")
doesn't always return an array, but sometimes an object too, in which case this error is triggered. Not sure about the internals of blocks, but maybe that's an upstream issue?As a quick fix this works:
The text was updated successfully, but these errors were encountered: