menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

The JS Bundle Wars.
source image

Dev

6d

read

161

img
dot

Image Credit: Dev

The JS Bundle Wars.

  • The JS Bundle Wars concern the use of ES modules (esm) and CommonJS (cjs) in JavaScript development.
  • The author discusses the relevance of UMD and AMD modules in the current JavaScript ecosystem.
  • Questions may arise about references to 'es' and the required version like es2020 or esnext.
  • Teams may query how assets and CSS are bundled, highlighting the complexity of the topic.
  • The author starts by detailing a simple 'hello world' application using Vanilla JS without React.
  • The repository 'js-bundle-war' is used for experimentation with the code.
  • The author uses Vite as the bundler instead of webpack for simplicity.
  • The bundling process involves importing ES modules and using a script type='module' tag in an index.html file.
  • A package.json file with Vite as a devDependency and build script is utilized.
  • The default Vite configuration bundles assets like JS, CSS, and SVGs, and creates the necessary HTML files.
  • Vite-specific details like a polyfill for modulepreload and inlining certain SVGs are highlighted.
  • Assets are managed based on their location, either under /public or src/ in the build output.
  • Components are minified during the bundling process.
  • The bundled output includes the main.js file with all dependencies handled.
  • The author concludes by emphasizing the ongoing nature of the JS Bundle Wars.
  • The topic is considered complex and impactful in modern JavaScript development.
  • The article reflects on the importance of understanding bundling processes for web development.
  • The author expresses a desire to potentially write a book on this subject in the future.

Read Full Article

like

9 Likes

For uninterrupted reading, download the app