Interesting take on bundlers:
Over the last several years, JavaScript bundling has morphed from a production-only optimization into a required build step for most web applications. Whether you love this or hate it, it’s hard to deny that bundlers have added a ton of new complexity to web development – a field of development that has always taken pride in its view-source, easy-to-get-started ethos.
@pika/web is an attempt to free web development from the bundler requirement. In 2019, you should use a bundler because you want to, not because you need to.
Here’s how Pika does it:
@pika/web installs modern npm dependencies in a way that lets them run natively in the browser, even if they have dependencies themselves. No Browserify, Webpack or import maps required.
npm install && npx @pika/web ✔ @pika/web installed web-native dependencies. [0.41s]
Pika does this by transforming all required packages into ES Modules, which are then stored in a web_modules
folder. Import your packages from said location and you’re good to go:
import {slugy} from './web_modules/slugy.js';
const textToSlug = 'Hello World, @pika/web!';
document.getElementById('slugy-text').innerHTML = `slugy("${textToSlug}") <br/>➡️ ${slugy(textToSlug)}`;
If your browser supports ES Modules, you can run the code snippet above directly in your browsers – no adjustments required 🙂
Leave a comment