Browser Requires Disclosure Flow

I have a problem with requiring programmatically created browser modules.

var File = require("vinyl"),
    browserify = require("browserify");

bundler = browserify();
bundler.require(new File({contents: new Buffer(...)}), {expose: "mymodule"});

bundler.bundle();
...

In the output file, I have the contents of the buffer, but "mymodule" is not displayed.

Has anyone used this case?

+4
source share
2 answers

It was a bug in the browser, but fixed with this patch: https://github.com/substack/node-browserify/pull/907

and your above code should work in version 6.0.1 and higher

+1
source

Since this question was posted by James Holliday (substack, browser maker), it was hard to work with the browser reference: https://github.com/substack/browserify-handbook

. , . , , , - . , ( - , ), , .

, , , , , .

, tagtree: http://tagtree.tv/browserify-an-intro?share_code=uncoopered-inspirer

+1

Source: https://habr.com/ru/post/1533686/


All Articles