Ok, so modules written for node.js can be bundled with browserify.
First, I'm not sure what you mean by this, since a browser was created to do the opposite. Browserify was made to allow the use of node require () statements in the browser.
But just in case, I only have a bunch of bundles created by the browser and not the source, would it be possible to “require” or otherwise use these packages and their contents in the node.js environment other than the browser? (assuming the code doesn't do something like a browser)
In short, if the modules do not use the global area of the window, because the window is undefined in node.js. Common helper packages like lodash, axios, moment, bluebird and q promises work in node.js.
As a rule, packages are often modified to work both in the browser and in node.js. There is a browser attribute option in the package.json files that allows you to specifically target your browser when publishing npm modules. Often, files intended for the browser are reduced to one file because of how the files can be imported into the browser. This is optional for a node, and there can be many files in a node project.
source share