Previously, you'd have to create a separate file for using 6to5 with both node and browserify, as the latter wasn't able to properly handle loading 6to5's dependency tree and would crash on attempting to do so. This change instructs browserify to use "register-browser.js" in place of "register.js". "register-browser.js" still loads the 6to5 polyfill, but is otherwise ignored.
20 lines
591 B
JavaScript
20 lines
591 B
JavaScript
var browserify = require("browserify");
|
|
var assert = require("assert");
|
|
var path = require("path");
|
|
var vm = require("vm");
|
|
|
|
suite("browserify", function() {
|
|
test("6to5/register may be used without breaking browserify", function(done) {
|
|
var bundler = browserify(path.join(__dirname, "fixtures/browserify/register.js"));
|
|
|
|
bundler.bundle(function(err, bundle) {
|
|
if (err) return done(err);
|
|
assert.ok(bundle.length, "bundle output code");
|
|
|
|
// ensure that the code runs without throwing an exception
|
|
vm.runInNewContext(bundle, {});
|
|
done();
|
|
})
|
|
})
|
|
});
|