devtools-core icon indicating copy to clipboard operation
devtools-core copied to clipboard

Remove unused code

Open jasonLaster opened this issue 8 years ago • 4 comments

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 avatar Aug 03 '17 21:08 jasonLaster

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

jasonLaster avatar Aug 07 '17 19:08 jasonLaster

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

wldcordeiro avatar Aug 07 '17 20:08 wldcordeiro

@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).

zaggy avatar Aug 08 '17 08:08 zaggy

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

wldcordeiro avatar Aug 09 '17 23:08 wldcordeiro