Browserify: Piping into browserify doesn't work

Created on 27 Sep 2018  路  4Comments  路  Source: browserify/browserify

I have a read stream that pipe to stdout:

const {Readable} = require('stream');

let data = `console.warn('FOO');`;

const stream = new Readable();

stream.push(data);
stream.push(null);
stream.pipe(process.stdout);

Its name is entry.js. When executing node entry.js, I can confirm that console.warn('FOO'); is successfully piped to stdout.

But when I try to pipe it into browserify, the resulting bundle doesn't contain console.warn('FOO');:

node entry.js | browserify

How can I pipe into browserify using the CLI?

Most helpful comment

Use browserify - (- means stdin):

node entry.js | browserify -

All 4 comments

Use browserify - (- means stdin):

node entry.js | browserify -

Thank you so much. Is it a standard way of piping that I don't know about or something specific to Browserify?

It's conventional in many Unixy command line tools . It is specific to Browserify in that there is some code on our side to implement this, it's not built in to node or anything. But many CLIs that take input files do support it

Good to know. Thanks for your help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flowerornament picture flowerornament  路  12Comments

rkirsling picture rkirsling  路  6Comments

esamattis picture esamattis  路  11Comments

saeedseyfi picture saeedseyfi  路  6Comments

ghost picture ghost  路  4Comments