Created
June 10, 2013 07:05
-
-
Save trevordixon/5747010 to your computer and use it in GitHub Desktop.
Speeding up browserify with a huge lib. Using https://github.com/ForbesLindesay/browserify-middleware with Express.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Each of these takes just a few milliseconds | |
app.get('/js/main.js', browserify('./public/js/main.js', { | |
external: ['three'], | |
detectGlobals: false | |
})); | |
app.get('/js/three.js', browserify(['three'], { | |
noParse: ['three'], // doesn't parse to look for global vars OR calls to require; just includes as-is | |
cache: true, // instructs browser to cache, even in dev, because this won't be changing | |
debug: false // no source map | |
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main.js requires three, and it took about 6 seconds to build | |
app.get('/js/main.js', browserify('./public/js/main.js')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment