browserify makes this possible for many modules, but the browser is a different environment (ex: no file system access) so we're going to need a few things if we want to run just anything:
1- browser versions of the native modules
-
many are detailed here
-
others like
fs
will need to be built: -
abandoned wip browser filesystem that writes to webkit storage (?)
-
my attempt at an in-memory-only fs (ideally this would be used with "persistance adapters" and would hook into FSEventer) hack-in-progress
2- a way to get browserify use them
-
current version of browserify ("2.17.3") uses browser-resolve "0.1.1" which supplies the builtins that were later removed
-
you can manually add a browser
fs
implementation to that version of browser-resolve's/builtin/fs.js
(to modify the core modules used by global browserify look here:/usr/local/share/npm/lib/node_modules/browserify/node_modules/browser-resolve/builtin
) -
or you could get this branch of browserify that lets you specify global module overrides when bundling
3- a native-grade implementation of process
1 - some native modules also need extending
path.js is missing ["sep","exists","existsSync","_makeLong"]
presumably b/c they require the file-system
EDIT
["exists", "existsSync"] are deprecated
"sep" is just "/" (on this machine)
and "_makeLong" is function (path) {\n return path;\n } (on this machine)
so no biggy