I just realised that the Web Components polyfills not only are in npm so you can install them like this:
npm install --save webcomponents-lite
but they also have a well formed package.json with a main entry.
So if you’re writing your front-end code with Browserify and want to load the polyfill without adding an additional script tag, you can do this:
and this pulls the polyfill into the scope.
NICE! Thanks, Addy
PS I guess this should also work with webpack, if you’re so inclined.
I saw a project yesterday that was built using webpack, and I started to wonder what makes webpack better than Browserify? The website didn’t really explain to me, so I asked in Twitter because I was sure there would be a bunch of webpack experts ready to tell me—and I wasn’t wrong!
Webpack comes with “batteries included” and preconfigured, so you get more “out of the box”, it’s easier to get started, and the default outputs are really decent. Whereas with browserify you need to choose the modules you want to use, and essentially assemble the whole thing together: it’s slower to learn, but way more configurable.
“Just turn it into a node module,” and other mantras Edna taught me
The story of leaving behind a random mix of Python + php + bash + makefile + Scons scripts to totally embrace using Node, modules, standard callbacks, browserify, and friends to build toys that bleep and bloop with MIDI, WebGL and Web Audio.
As you can maybe deduct, this might not be your average super expert node.js talk, but a story of learning with a non-appointed mentor and an spontaneous community, and improving and making the most out of node.js—and how it informed and shaped the rest of my coding philosophy, both inside and outside of Mozilla.
I must confess that I’m really humbled and flattered to be amongst this amazing line up of true node experts.
UUUUUUUHHH THE EXPECTATIONS!—feeling a bit like an impostor now.
Next next Saturday 19th of July. See you there?