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

Non-dead code removed #33

Open
raybooysen opened this issue Apr 23, 2015 · 1 comment
Open

Non-dead code removed #33

raybooysen opened this issue Apr 23, 2015 · 1 comment

Comments

@raybooysen
Copy link

Not sure if this is an uglifyify problem or an uglify problem, but we're seeing cases where non-dead code is dropped. Consider the following:

var result
var useX = //some code here;
if(useX) {
  result = require('./someotherModuleX');
} 
else {
 result = require('./someotherModuleY');
}
module.exports = result;

When we run this through uglifyify, both someOtherModuleX and someOtherModuleY are removed.

However, this works:

var useX = //some code here;
if(useX) {
  module.exports = require('./someotherModuleX');
} 
else {
 module.exports = require('./someotherModuleY');
}

A sample app is here:

https://github.com/raybooysen/uglifyifyExample

@weilu
Copy link
Collaborator

weilu commented May 11, 2015

It's a strange case -- I inspected the buffer value before ujs.minify is even called: https://github.com/hughsk/uglifyify/blob/master/index.js#L70. It's already missing the two required files. Pushed the failing test case to a branch: cd38bb4

@hughsk browserify bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants