Registry / web-framework / esbuild-standalone

esbuild-standalone

JSON →
library0.0.19jsnpmunverified

esbuild-standalone v0.0.19 provides a standalone build of Esbuild for use in browsers, leveraging Service Worker and esbuild-wasm to enable JSX/TSX transpilation without a Node.js build step. It is an alternative to @babel/standalone and esm.sh/tsx, offering faster compilation via Esbuild. It supports inline (no SW) and external (SW) setups, works with import maps, and handles script types like text/babel, text/jsx, text/tsx, etc. Release cadence is irregular; version 0.0.x suggests early development. Key differentiators: easy prototyping in HTML, Service Worker caching, and use of Esbuild's speed.

npm install esbuild-standalone
INSTALL
IMPORT
SIG · ESBUILD-STANDALONE
E
esbuild-standalone
web-frameworkjavascriptv0.0.19
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

main (default)
import 'https://esm.sh/esbuild-standalone'
import esbuildStandalone from 'esbuild-standalone'
The package is a side-effect module that auto-processes <script> tags; no named exports.
Service Worker (default)
importScripts('https://unpkg.com/esbuild-standalone@0.0.19/service-worker.js')
import 'esbuild-standalone/service-worker'
Use importScripts in classic SW, or import in module SW from the .mjs file.
ESM Service Worker (default)
import 'https://unpkg.com/esbuild-standalone@0.0.19/service-worker.mjs'
import 'esbuild-standalone/sw'
Module SW files use .mjs extension; ensure correct path.

Shows inline setup with importmap and JSX transpilation via esbuild-standalone without a build step.

<!DOCTYPE html> <html lang="en"> <head> <script type="importmap"> { "imports": { "react": "https://esm.sh/react@19.0.0", "react/jsx-runtime": "https://esm.sh/react@19.0.0/jsx-runtime.js?external=react", "react-dom/client": "https://esm.sh/react-dom@19.0.0/client?external=react" } } </script> <script src="https://esm.sh/esbuild-standalone" type="module"></script> </head> <body> <div id="root">Loading...</div> <script type="text/babel"> import { useState } from 'react'; import { createRoot } from 'react-dom/client'; function App() { const [count, setCount] = useState(0); return <div> <h2>Hello, esbuild-standalone!</h2> <button onClick={() => setCount(v => v + 1)}>Count: {count}</button> </div>; } createRoot(document.getElementById('root')).render(<App />); </script> </body> </html>
Debug
Known issues
gotchaExternal dependencies (e.g., React) must be marked with ?external in importmap to avoid duplicate bundle instances.
fix
Use ?external=react in importmap URLs as shown in the quickstart.
affects: >=0.0.0
gotchaService Worker must be served from the root path (e.g., /service-worker.js) due to scope restrictions.
fix
Place service-worker.js in your public root or use data-sw-url to specify alternative path.
affects: >=0.0.0
gotchaWithout Service Worker setup, features like caching and external compilation are limited; inline usage may have reduced performance.
fix
Set up Service Worker files as described in the documentation for full functionality.
affects: >=0.0.0
breakingVersion 0.x.x is unstable; API and behavior may change without notice.
fix
Pin a specific version in production or use alternative like @babel/standalone.
affects: >=0.0.0 <1.0.0
gotchaThe package uses esbuild-wasm, which may have slower initial load due to Wasm binary download (~8MB).
fix
Preload or cache the Wasm file using Service Worker to improve performance.
affects: >=0.0.0
Errors
Common errors & fixes
Failed to register Service Worker: The script has an unsupported MIME type ('text/html').
Service worker file not found or served as HTML instead of JavaScript.
fix
Ensure the service-worker.js file is accessible at the correct path and served with Content-Type: text/javascript.
Uncaught (in promise) DOMException: Failed to construct 'Worker': Script at '...' cannot be loaded.
Cross-origin restrictions or invalid path for service worker script.
fix
Serve service-worker.js from same origin (root path) or use data-sw-url with a correct URL.
Cannot find module 'react' (imported from...)
Missing or incorrect import map entries for external dependencies.
fix
Define import map with correct URLs and ?external query for singleton libraries like React.
Upgrade
Version history
0.0.19latest on npm
Audit
Dependencies
esbuild-wasmoptionalUsed for Wasm-based transpilation
service-workerrequiredBrowser Service Worker API required for full functionality
Agent activity
6 hits · last 30 days
node
6
Resources
esbuild-standalone — npm install esbuild-standalone · libregistry