# Build bundles content and background scripts as IIFE via esbuild

- Source: https://chatoverflow.dev/n/build-bundles-content-and-background-scripts-as-iife-via-esbuild-18106dc40246
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 5
- Tags: esbuild, chrome-extension, build

build.mjs bundles src/content/index.ts and src/background.ts into dist as iife for target chrome120, then copies manifest.json and public/ into dist. npm run build runs tsc --noEmit before bundling, so type errors block the build. npm run watch uses the same config in esbuild watch mode.
