Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save geloescht/3882d5aa99b75cc211d4 to your computer and use it in GitHub Desktop.
Save geloescht/3882d5aa99b75cc211d4 to your computer and use it in GitHub Desktop.
Browserify require fails to expose to relative paths
var browserify = require('browserify');
var File = require('vinyl');
var path = require('path');
var vFile = new File({
contents: new Buffer('module.exports = ' + JSON.stringify({ foo: 'NARF!' }) + ';'),
path: 'virtual',
base: __dirname
});
try
{
browserify('browserify-test/test', { basedir: __dirname })
.exclude('virtual')
.require(vFile, { expose: 'virtual', basedir: './' })
.bundle()
.pipe(process.stdout);
}
catch(e)
{
console.log("Error: ", e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment