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

uglifyify is dropping a file #40

Open
tolmasky opened this issue Sep 22, 2015 · 3 comments
Open

uglifyify is dropping a file #40

tolmasky opened this issue Sep 22, 2015 · 3 comments

Comments

@tolmasky
Copy link

index.js:

require("babel-core/lib/generation")

browserify.js:

var gulp = require("gulp");

var browserify = require("browserify");
var source = require('vinyl-source-stream');
var gulp = require("gulp");


    var bundle = browserify({
        entries: ["./index.js"],
        debug: true,
        cache: {},
        packageCache: {},
        fullPaths: true
    })

   // If I comment out uglifyif then it works again.
    bundle = bundle.transform('uglifyify', { global: true });

    return bundle.bundle()
                 .pipe(source("main.bundle.js"))
                 .pipe(gulp.dest("./assets"));

Running node browserify.js breaks because node_modules/babel-core/node_modules/source-map/lib/base64-vlq.js disappears.

@tolmasky
Copy link
Author

Heres the project if you're interested: http://tolmasky.com/letmeshowyou/uglifyify-bug.zip

@tolmasky
Copy link
Author

Further inspection shows that it is mangle:true that is causing it (mangle:false leaves the file alone).

@tolmasky
Copy link
Author

I figured this out. The file in question does this:

(function (require)
{
})(require)

Thus, the require is mangled in the function, and then not gotten. By blacklisting "Require" to never be mangled it solves this. However, given that this was something that took place in a dependency's dependency (and of a popular package), I think blacklisting "require" should maybe be the default behavior. OR, its possible that this is broken in that it should first grab dependencies then mangle.

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

1 participant