Registry / web-framework / bundler-in-browser

bundler-in-browser

JSON →
library0.3.0jsnpmunverified

a browser-native bundler (v0.3.0) that automatically installs npm packages, powered by esbuild-wasm. Runs entirely in the browser — no server required. Supports plugins for TailwindCSS, Sass, Vue 3 SFC, and virtual filesystems via @zenfs/core. Smart caching of vendor bundles for performance. Differentiates from alternatives like Webpack or Rollup by running client-side and auto-resolving dependencies. Weekly releases on npm. TypeScript types included.

npm install bundler-in-browser
INSTALL
IMPORT
SIG · BUNDLER-IN-BROWSER
B
bundler-in-browser
web-frameworkjavascriptv0.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BundlerInBrowser
import { BundlerInBrowser } from 'bundler-in-browser'
const BundlerInBrowser = require('bundler-in-browser')
ESM-only package; require will fail in Node. Use import.
wrapCommonJS
import { wrapCommonJS } from 'bundler-in-browser'
import wrapCommonJS from 'bundler-in-browser'
wrapCommonJS is a named export, not default. ESM-only.
installSassPlugin
import { installSassPlugin } from 'bundler-in-browser'
Named export for optional Sass support. Requires 'sass' package installed.
installVuePlugin
import { installVuePlugin } from 'bundler-in-browser'
Named export for Vue 3 SFC support. Requires 'vue' package installed.

Shows initialization, virtual filesystem setup, bundling, and executing CommonJS output with CSS injection.

import { BundlerInBrowser, wrapCommonJS } from 'bundler-in-browser'; import { fs } from '@zenfs/core'; fs.mkdirSync('/src'); fs.writeFileSync( '/src/index.js', ` import confetti from "canvas-confetti"; confetti(); const elt = document.createElement('h1'); elt.textContent = 'BundlerInBrowser!'; document.body.appendChild(elt); ` ); const bundler = new BundlerInBrowser(fs); await bundler.initialize(); bundler.config.entrypoint = '/src/index.js'; const buildResult = await bundler.build(); const run = new Function('return ' + wrapCommonJS(buildResult.js)); const userExports = run(); if (buildResult.css) { const style = document.createElement('style'); style.textContent = buildResult.css; document.head.appendChild(style); }
Debug
Known issues
gotchaRequires path-browserify alias in bundler config (Vite, Webpack, Rollup) to resolve 'path' module
fix
Add resolve alias: 'path': 'path-browserify' in your bundler config.
affects: >=0.1.0
gotchainitialize() must be called once before any build; multiple calls re-initialize esbuild-wasm
fix
Ensure you await bundler.initialize() only once or check if already initialized.
affects: >=0.1.0
breakingwrapCommonJS is required to execute the build output; output is CommonJS, not a direct string
fix
Always use wrapCommonJS(buildResult.js) before eval/new Function.
affects: >=0.1.0
gotchaesbuild-wasm must be installed separately; not bundled as peer dependency
fix
Run npm install esbuild-wasm alongside bundler-in-browser.
affects: >=0.1.0
deprecatedSass plugin may require specific sass version; peer dep is ^1.77.8
fix
Install sass@^1.77.8 to ensure compatibility.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'path'
Browser environment lacks Node.js 'path' module
fix
Add resolve alias: 'path': 'path-browserify' in your bundler config (Vite/Webpack/Rollup).
TypeError: bundler.initialize is not a function
Incorrect import; likely default import instead of named
fix
Use import { BundlerInBrowser } from 'bundler-in-browser' (named export).
Error: esbuild-wasm not found
Missing esbuild-wasm peer dependency
fix
Run npm install esbuild-wasm.
ReferenceError: wrapCommonJS is not defined
wrapCommonJS is a named export, not default
fix
Use import { wrapCommonJS } from 'bundler-in-browser'.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
@zenfs/corerequiredvirtual filesystem required for source code and node_modules
esbuild-wasmrequiredcore bundling engine
sassoptionaloptional Sass plugin dependency
vueoptionaloptional Vue SFC plugin dependency
path-browserifyoptionalpolyfill for Node.js path module (needed in browser)
Agent activity
15 hits · last 30 days
node
10
OpenAI (training)
1
Resources
bundler-in-browser — npm install bundler-in-browser · libregistry