node-libs-browser icon indicating copy to clipboard operation
node-libs-browser copied to clipboard

Incompatibility between Node.js core libs and webpack's lib

Open azu opened this issue 6 years ago • 4 comments

I've collected the gap between Node.js core lib and webpack/browserify's shim lib.

Latest results is in following repository.

Env

  • Node.js 10.0.0
  • webpack 4.6.0

Gap list

Node.js Browser shim Issue Link
assert defunctzombie/commonjs-assert Error code and Error message are different Issue, Article
assert.deepEqual does't support Map, Set, Iterator etc... Issue, Document, Release
require("assert").strict Docs, Release
buffer feross/buffer ---
child_process --- ---
cluster --- ---
console Raynos/console-browserify ---
constants juliangruber/constants-browserify ---
crypto crypto-browserify/crypto-browserify ---
dgram --- ---
dns --- ---
domain bevry/domain-browser ---
events Gozala/events eventNames Issue
getMaxListeners Issue
prependListener Issue
prependOnceListener Issue
off Issue
fs --- ---
http jhiesey/stream-http ---
https substack/https-browserify ---
module --- ---
net --- ---
os CoderPuppy/os-browserify os.constants
path substack/path-browserify path.posix Issue
path.parse(path) Issue
path.win32
path.format(pathObject)
process shtylman/node-process process.channel
process.platform Issue
process.execArgv Issue
process.cpuUsage([previousValue])
process.emitWarning(warning[, options])
punycode bestiejs/punycode.js ---
querystring mike-spainhower/querystring ---
readline --- ---
repl --- ---
stream substack/stream-browserify ---
string_decoder rvagg/string_decoder --- Repository
sys defunctzombie/node-util ---
timers jryans/timers-browserify ---
tls --- ---
tty substack/tty-browserify ---
url defunctzombie/node-url url.URL(WHATWG URL) Release, Document, Issue
url.format does't support WHATWG URL Release, Document
util defunctzombie/node-util util.callbackify(original)
util.inspect.custom
util.inspect.defaultOptions
util.promisify(original)
util.promisify.custom
util.inspect() options maxArrayLength, breakLength
util.isDeepStrictEqual
vm substack/vm-browserify vm.isContext(sandbox)
zlib devongovett/browserify-zlib zlib.bytesRead

Tests

Also, I've written the test for these new methods/properties.

Node.js 10 pass the tests, but the code that is bundled by webpack is failed.

azu avatar May 01 '18 11:05 azu

eventNames, getMaxListeners, prependListener and prependOnceListener are available in [email protected] (https://github.com/webpack/node-libs-browser/pull/74). off will be available in [email protected].

goto-bus-stop avatar May 18 '18 13:05 goto-bus-stop

path.posix, path.parse, and parth.format are available in [email protected]

billiegoose avatar Nov 06 '18 16:11 billiegoose

@azu thanks for compiling that list. That will definitely be helpful when updating the libraries 👍

We can't do that too frequently as updating these libraries might be breaking change for a lot of people.

jhnns avatar Feb 06 '19 16:02 jhnns

Since node-libs-browser is not active and updated anymore, I’ve taken time and created package which is based on this one but updates it to modern implementation.

niksy avatar Nov 13 '21 17:11 niksy