firefox-devtools / devtools-core

:rocket: Packages for Firefox DevTools
142 stars 97 forks source link

Remove unused code #553

Open jasonLaster opened 7 years ago

jasonLaster commented 7 years ago

It's pretty common to get unreachable code warnings in our mochitests. We should remove these because dead code is extra kb and it fills up the logs.

Babel has a useful plugin, which we should be able to use.

https://babeljs.io/docs/plugins/minify-dead-code-elimination/

2252 INFO Console message: [JavaScript Warning: "unreachable code after return statement" {file: "resource://devtools/client/debugger/new/parser-worker.js" line: 22801}]
jasonLaster commented 7 years ago

I started this branch to add uglify which looks like it should be perfect... but no luck

https://github.com/webpack-contrib/uglifyjs-webpack-plugin

https://github.com/jasonLaster/devtools-core/tree/uglify

wldcordeiro commented 7 years ago

@jasonLaster uglify has had its troubles with ES6/Babel code. Might be worth fiddling with babili? https://github.com/babel/babili

zaggy commented 7 years ago

@wldcordeiro, I would vote for uglify for the reason that code minification probably should be a part of the webpack pipeline and not a part of just one of the tasks. It is more future proof if we would like to add or change something in the webpack pipeline (typescript, maybe).

wldcordeiro commented 7 years ago

@zaggy we've put a lot of work into using Flow so I'm doubtful of Typescript being included. 😉