node options flag not recognized using gulp and browserify
See original GitHub issueBrowserify shims the core http
module with stream-http
for browser compatibility, and has a --node
flag to prevent this from happening. However, I am unable to do this through gulp, or the documentation does not explain how. I would like to perform the following and not have the stream-http
module included in my final browserify bundle:
gulp.task('scripts:server', () => {
const bundler = browserify(
'build/source/server.js',
{
debug: true,
node: true,
}
);
const bundlerError = (err) => {
console.error(err);
};
return bundler.bundle()
.on('error', bundlerError)
.pipe(source('server.js'))
.pipe(buffer())
.pipe(gulp.dest('dist'));
});
I can see the bare: true
and browserField: false
do something if I pass them into browserify as options, however, node: true
seems to have no effect.
If I run browserify as a command and not through gulp, it works just fine:
browserify --node build/source/server.js -o dist/server.js
Issue Analytics
- State:
- Created 8 years ago
- Comments:14
Top Results From Across the Web
Gulp + Browserify task not working (no output) - Stack Overflow
I'm now maintaining a repository which collecting all the gulp tasks I use in daily work. This is the browserify task code. var...
Read more >Gulp + Browserify - Viget
I picked up Gulp and Browserify just days after learning Grunt ... The first time using CommonJS (Node) modules was a breath of...
Read more >Webpack or Browserify & Gulp: Which Is Better? - Toptal
In this article, Toptal Freelance Software Engineer Eric Grosse shows us how various combinations of the popular tools Webpack, Browserify, Gulp and Npm...
Read more >Browserify
First install node, which ships with npm. ... Here is a tutorial on how to use Browserify on the command line to bundle...
Read more >rollup.js
To use Rollup with a configuration file, pass the --config or -c flags: ... with NPM, compiling code with Babel, working with JSON...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Through the api the parameters necessary to replicate
--node
are:That’s how my gulp task looks like:
Hope this helps someone.
I faced the same issue using browserify to bundle my javascript modules in an Electron app. I ended-up with the following options: