Skip to content

Instantly share code, notes, and snippets.

@Raynos

Raynos/x.js Secret

Created August 22, 2012 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/2321202ce8df9919ef19 to your computer and use it in GitHub Desktop.
Save Raynos/2321202ce8df9919ef19 to your computer and use it in GitHub Desktop.
var bundle = browserify({
debug: true
})
, code = "var process = require.modules.__browserify_process();\n" +
"process.env.NODE_ENV = 'production'\n" +
"require.modules.__browserify_process = function () {\n" +
" return process\n" +
"}"
var target = path.join(__dirname, "dummy.js")
bundle.files[target] = {
target: target
, body: code
}
bundle.addEntry(path.join(__dirname, "other.js"), {
body: "require('" + target + "')"
})
bundle.addEntry(input)
var text = bundle.bundle()
fs.writeFileSync(output, text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment