question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

babel-plugin-minify-dead-code-elimination `SequenceExpression` use case

See original GitHub issue

SequenceExpression in ExpressionStatement containing UnaryExpression(void 0) does not remove dead code.

I realize this is a small use case, but if an ExpressionStatement contains a SequenceExpression with void 0 it can be removed with no worry of side-effects.

  a, b, c, d, void 0;

should be:

  a, b, c, d;

Thanks for reading!

-Josh

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
boopathicommented, Jan 16, 2017

It’s an unsafe transformation -

function f1() {
  return 1, 2, void 0;
}

function f2() {
  return 1, 2;
}

console.log(f1(), f2()); // will print undefined, 2
1reaction
kangaxcommented, Jan 16, 2017

This is similar to https://github.com/babel/babili/pull/197 where we remove undefined only when it’s in a “safe” context.

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel-plugin-minify-dead-code-elimination
Example. In function foo() {var x = 1;} function bar() { var x = f(); } function baz() { var x = 1;...
Read more >
babel-plugin-minify-dead-code-elimination - npm
Inlines bindings when possible. Tries to evaluate expressions and prunes unreachable as a result.. Latest version: 0.5.2, last published: 8 ...
Read more >
package-lock.json - plugins/code-coverage - Git at Google
"resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.0.tgz",.
Read more >
Third Party Software 5.2.1 - Confluent
Confluent is building the foundational platform for data in motion so any organization can innovate and win in a digital-first world.
Read more >
@emotion/babel-plugin | Yarn - Package Manager
Uglifyjs will use the injected /*#__PURE__*/ flag comments to mark your css and styled blocks as candidates for dead code elimination. Source Maps,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found