Loading webcomponents-lite with require()

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:


require('webcomponents-lite');

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.