Comments (5)
Should I map node built-in packages to https://www.npmjs.com/package/browser-builtins ?
from getlibs.
Looks like browserify no longer relies on browser-builtins bundle but maps to individual packages - https://unpkg.com/[email protected]/lib/builtins.js . So I guess I should do the same thing here.
from getlibs.
I spent a while looking at this topic yesterday... namely comparing https://github.com/calvinmetcalf/rollup-plugin-node-builtins and https://unpkg.com/[email protected]/lib/builtins.js. Unfortunately, some of the choices rollup makes (like buffer-es6
) are just forks of the browserify versions that are not as well maintained. (buffer-es6
is a good 100 commits behind buffer
). I ultimately decided not to use rollup-plugin-node-builtins
but rather use both rollup
and browserify
in consecutive build steps.
So... that illustrates the wonderful wonderful thing about getlibs
I like so much. When it works It just works (TM). None of these awful build tools... which are wonderful yes, but now that I've tasted dynamic module loading I can't see how anyone would ever want to go back.
I'm rambling off topic. Yes, let's use the mappings in https://unpkg.com/[email protected]/lib/builtins.js
except for the empty ones and ones that don't make sense. (console?)
from getlibs.
A'ight, so I've whittled down the list to these:
assert: https://unpkg.com/assert
buffer: https://unpkg.com/buffer
crypto: https://unpkg.com/crypto-browserify
domain: https://unpkg.com/domain-browser
events: https://unpkg.com/events
http: https://unpkg.com/stream-http
https: https://unpkg.com/https-browserify
os: https://unpkg.com/os-browserify
path: https://unpkg.com/path-browserify
punycode: https://unpkg.com/punycode
querystring: https://unpkg.com/querystring
stream: https://unpkg.com/stream-browserify
util: https://unpkg.com/util
tty: https://unpkg.com/tty-browserify
url: https://unpkg.com/url
vm: https://unpkg.com/vm-browserify
zlib: https://unpkg.com/browserify-zlib
process: https://unpkg.com/process
I need to think of a good way to test them. Lemme grab a coffee.
from getlibs.
Test playground: https://codepen.io/wmhilton/project/editor/XbNoRz
Using configuration:
System.config({
meta: {
//util: {loader: 'js'}
},
map: {
assert: 'https://unpkg.com/assert',
buffer: 'https://unpkg.com/buffer',
crypto: 'https://unpkg.com/crypto-browserify',
domain: 'https://unpkg.com/domain-browser',
events: 'https://unpkg.com/events',
http: 'https://unpkg.com/stream-http',
https: 'https://unpkg.com/https-browserify',
os: 'https://unpkg.com/os-browserify',
path: 'https://unpkg.com/path-browserify',
punycode: 'https://unpkg.com/punycode',
querystring: 'https://unpkg.com/querystring',
stream: 'https://unpkg.com/stream-browserify',
util: 'https://unpkg.com/util/util.js',
'util/': 'https://unpkg.com/util/util.js',
tty: 'https://unpkg.com/tty-browserify',
url: 'https://unpkg.com/url',
vm: 'https://unpkg.com/vm-browserify',
zlib: 'https://unpkg.com/browserify-zlib',
process: 'https://unpkg.com/process'
}
})
System.load('./main.js')
Here's my results so far. commented out ones fail.
const { Buffer } = require('buffer');
alert(Buffer.isBuffer);
global.Buffer = Buffer
alert(require('process'));
global.process = require('process');
alert(require('assert'));
//alert(require('crypto'));
alert(require('domain'));
alert(require('events'));
//alert(require('http'));
//alert(require('https'));
alert(require('os'));
alert(require('path'));
alert(require('punycode'));
//alert(require('querystring'));
alert(require('stream'));
alert(require('util'));
alert(require('tty'));
alert(require('vm'));
//alert(require('zlib'));
//alert(require('url'));
from getlibs.
Related Issues (11)
- ES6 module exports on .vue files HOT 8
- unpkg is not loading getlibs
- Any plan to upgrade to Babel 7?
- Targeting specific version of a library HOT 1
- My own modules HOT 1
- Import/require unbundled packages HOT 4
- 'react' library keeps trying to load from 'cdnjs.cloudflare.com' even when mapped to unpkg.com HOT 2
- Better handling of unpkg.com 302 redirects
- way to permanently disable cdnjs ? HOT 2
- material2 Failed to load resource: the server responded with a status of 404 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from getlibs.