{"id":25450,"library":"esbuild-standalone","title":"esbuild-standalone","description":"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.","status":"active","version":"0.0.19","language":"javascript","source_language":"en","source_url":"https://github.com/crutch12/esbuild-standalone","tags":["javascript"],"install":[{"cmd":"npm install esbuild-standalone","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-standalone","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-standalone","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for Wasm-based transpilation","package":"esbuild-wasm","optional":true},{"reason":"Browser Service Worker API required for full functionality","package":"service-worker","optional":false}],"imports":[{"note":"The package is a side-effect module that auto-processes <script> tags; no named exports.","wrong":"import esbuildStandalone from 'esbuild-standalone'","symbol":"main (default)","correct":"import 'https://esm.sh/esbuild-standalone'"},{"note":"Use importScripts in classic SW, or import in module SW from the .mjs file.","wrong":"import 'esbuild-standalone/service-worker'","symbol":"Service Worker (default)","correct":"importScripts('https://unpkg.com/esbuild-standalone@0.0.19/service-worker.js')"},{"note":"Module SW files use .mjs extension; ensure correct path.","wrong":"import 'esbuild-standalone/sw'","symbol":"ESM Service Worker (default)","correct":"import 'https://unpkg.com/esbuild-standalone@0.0.19/service-worker.mjs'"}],"quickstart":{"code":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <script type=\"importmap\">\n  {\n    \"imports\": {\n      \"react\": \"https://esm.sh/react@19.0.0\",\n      \"react/jsx-runtime\": \"https://esm.sh/react@19.0.0/jsx-runtime.js?external=react\",\n      \"react-dom/client\": \"https://esm.sh/react-dom@19.0.0/client?external=react\"\n    }\n  }\n  </script>\n  <script src=\"https://esm.sh/esbuild-standalone\" type=\"module\"></script>\n</head>\n<body>\n  <div id=\"root\">Loading...</div>\n  <script type=\"text/babel\">\n    import { useState } from 'react';\n    import { createRoot } from 'react-dom/client';\n    function App() {\n      const [count, setCount] = useState(0);\n      return <div>\n        <h2>Hello, esbuild-standalone!</h2>\n        <button onClick={() => setCount(v => v + 1)}>Count: {count}</button>\n      </div>;\n    }\n    createRoot(document.getElementById('root')).render(<App />);\n  </script>\n</body>\n</html>","lang":"javascript","description":"Shows inline setup with importmap and JSX transpilation via esbuild-standalone without a build step."},"warnings":[{"fix":"Use ?external=react in importmap URLs as shown in the quickstart.","message":"External dependencies (e.g., React) must be marked with ?external in importmap to avoid duplicate bundle instances.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Place service-worker.js in your public root or use data-sw-url to specify alternative path.","message":"Service Worker must be served from the root path (e.g., /service-worker.js) due to scope restrictions.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set up Service Worker files as described in the documentation for full functionality.","message":"Without Service Worker setup, features like caching and external compilation are limited; inline usage may have reduced performance.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin a specific version in production or use alternative like @babel/standalone.","message":"Version 0.x.x is unstable; API and behavior may change without notice.","severity":"breaking","affected_versions":">=0.0.0 <1.0.0"},{"fix":"Preload or cache the Wasm file using Service Worker to improve performance.","message":"The package uses esbuild-wasm, which may have slower initial load due to Wasm binary download (~8MB).","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure the service-worker.js file is accessible at the correct path and served with Content-Type: text/javascript.","cause":"Service worker file not found or served as HTML instead of JavaScript.","error":"Failed to register Service Worker: The script has an unsupported MIME type ('text/html')."},{"fix":"Serve service-worker.js from same origin (root path) or use data-sw-url with a correct URL.","cause":"Cross-origin restrictions or invalid path for service worker script.","error":"Uncaught (in promise) DOMException: Failed to construct 'Worker': Script at '...' cannot be loaded."},{"fix":"Define import map with correct URLs and ?external query for singleton libraries like React.","cause":"Missing or incorrect import map entries for external dependencies.","error":"Cannot find module 'react' (imported from...)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}