javascript - Browserify: override package and use different main file -
browserify's "browser"
field in package.json
seems overloaded , can't figure out way around issue
how shim several packages not necessary in browser (such ws
, canvas
) while changing "main"
file browserify
's use
i hoping work
{ "browser": { "ws": "./src/browser/ws-shim", "main": "./src/browserversion" } }
src/browser/ws-shim
module.exports = global.websocket;
repository in question has specific node functionality such services on tcp
, stream
back upwards won't create sense in browser. meanwhile, utilize node ports of several browser apis share code between node
, browserify
ied versions of lib
use browser
key map main file.
{ "browser": "./src/browserindex.js" }
then utilize aliasify transform map rest of dependencies.
{ "browserify": { "transform": [ "aliasify" ] }, "aliasify": { "aliases": { "ws": "./src/browser/ws-shim" } }, "devdependencies": { "aliasify": "^1.4.0" } }
javascript node.js browserify
No comments:
Post a Comment