
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
Require different values in a web browser.
This module allows you to explicitly load different modules on the client than on the server without the need for aliasing. You can point to polyfilled globals, custom objects or functions or nothing at all. Subsequently, Browserify will be "tricked" out of bundling the original module, keeping your file size small.
Node.js >= 4 is required. To install, type this at the command line:
npm install broquire
broquire(id[, browserValue])In Node.js, the return value is always identical to regular require.
In a web browser, an empty Object will be returned if no browserValue is given:
var broquire = require("broquire")(require);
var utilities = broquire("./utils");
if (utilities.cleanup === undefined) utilities.cleanup = function(){};
If an Object is passed, then it will be returned:
var broquire = require("broquire")(require);
var utilities = broquire("./utils", { cleanup:function(){} });
If a String is given, then window[browserValue] will be returned:
var broquire = require("broquire")(require);
var URL = broquire("whatwg-url", "window").URL;
broquire.isBrowserHas a value of true when running in a web browser, and false when running in Node.js
broquire.isServerHas a value of true when running in Node.js, and false when running in a web browser.
Why do I need to pass require in to this function?
Every time Node.js executes a file, it gives you a version of require that will resolve modules relative to that file and directory. Passing your require to broquire allows it to import modules exactly as you would with a regular require statement.
FAQs
Require different values in a web browser.
We found that broquire demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.