Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One day browsers will natively support modules and "Bundle Splitting" as the article calls it will just be the intuitive and automatic thing to do. Until then we have webpack.


Unless you're still supporting IE, which is a big gotcha for some I know, then modules are a go now: https://caniuse.com/?search=modules

Vite is one of the first tools I know of taking advantage of this: https://vitejs.dev/

"On demand file serving over native ESM, no bundling required!"

I just launched a small production site using SvelteKit, which now uses this under the hood.


Most browsers do support js modules today but it's kind of an awkward situation to say the least. And if you need to support older browsers you may as well not bother, you probably use Webpack and/or Babel (or TypeScript) anyway for other reasons. Especially if you're trying to do isomorphic stuff for an SSR app, as NodeJS then has its own pile of idiosyncrasies and baggage around module support.

This situation has been playing out for many years and it has only gotten more confusing.


They do…




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: