{"id":17219,"library":"esbuild-darwin-64","title":"esbuild macOS 64-bit Binary","description":"esbuild is an extremely fast, next-generation JavaScript and CSS bundler and minifier, written in Go. This `esbuild-darwin-64` package provides the specific macOS 64-bit binary, acting as a platform-specific dependency for the main `esbuild` package. The project is actively maintained with frequent releases, currently at stable version `0.28.0`. Key differentiators include its exceptional speed, achieved through parallel parsing, printing, and source map generation, and its robust API for both JavaScript and Go. It supports ES6 and CommonJS modules, TypeScript, JSX, source maps, and minification, making it a versatile tool for modern web development.","status":"active","version":"0.15.18","language":"javascript","source_language":"en","source_url":"https://github.com/evanw/esbuild","tags":["javascript"],"install":[{"cmd":"npm install esbuild-darwin-64","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-darwin-64","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-darwin-64","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The `esbuild-darwin-64` package is a runtime dependency for the main `esbuild` package. Developers typically import the `build` function (and other APIs like `transform`, `serve`, `context`) from the `esbuild` package. CommonJS `require` still works but ESM imports are preferred.","wrong":"const esbuild = require('esbuild'); esbuild.build({...})","symbol":"build","correct":"import { build } from 'esbuild'"},{"note":"While `BuildContext` is a type/interface, the primary way to get a build context for incremental builds or watch mode is through the `context` function. You do not directly import `BuildContext` as a value.","wrong":"import { BuildContext } from 'esbuild'","symbol":"BuildContext","correct":"import { context } from 'esbuild'; const ctx = await context({...})"},{"note":"When defining esbuild plugins in TypeScript, `Plugin` is an interface and should be imported as a type (`import type`). This ensures it's stripped from the output JavaScript.","wrong":"import { Plugin } from 'esbuild'","symbol":"Plugin","correct":"import type { Plugin } from 'esbuild'"}],"quickstart":{"code":"import { build } from 'esbuild';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { dirname } from 'path';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Create a dummy input file\nimport fs from 'fs';\nconst inputTs = `\n  interface User { id: number; name: string; }\n  const user: User = { id: 1, name: 'Alice' };\n  console.log(`Hello, ${user.name}!`);\n  export { user };\n`;\nconst inputFilePath = path.join(__dirname, 'src', 'main.ts');\nconst outputDirPath = path.join(__dirname, 'dist');\n\nfs.mkdirSync(path.join(__dirname, 'src'), { recursive: true });\nfs.writeFileSync(inputFilePath, inputTs);\n\nasync function runBuild() {\n  try {\n    await build({\n      entryPoints: [inputFilePath],\n      bundle: true,\n      outdir: outputDirPath,\n      platform: 'node',\n      format: 'esm',\n      target: 'es2022',\n      minify: true,\n      sourcemap: true,\n      logLevel: 'info',\n      banner: { js: '// Built with esbuild' },\n      define: { 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'development') },\n    });\n    console.log(`\nBuild successful! Output in: ${outputDirPath}`);\n    console.log('Generated file content:');\n    console.log(fs.readFileSync(path.join(outputDirPath, 'main.js'), 'utf-8'));\n  } catch (e) {\n    console.error('Build failed:', e);\n    process.exit(1);\n  }\n}\n\nrunBuild();","lang":"typescript","description":"This quickstart demonstrates how to programmatically use esbuild's `build` API to bundle a TypeScript file, apply minification, generate sourcemaps, and define environment variables."},"warnings":[{"fix":"Review the esbuild changelog for `0.27.0` and higher versions to understand specific breaking changes and update your configuration or code accordingly. Pin esbuild versions in `package.json` for stability.","message":"esbuild `0.27.0` included deliberate backwards-incompatible changes. Users should pin exact versions or use tilde/caret ranges (e.g., `^0.26.0` or `~0.26.0`) to avoid automatically picking up breaking changes.","severity":"breaking","affected_versions":">=0.27.0"},{"fix":"Verify that your `esbuild` installations continue to function as expected. If issues arise, consult the `0.28.0` changelog for potential Go compiler-related differences or issues with integrity checks during installation.","message":"As of `esbuild@0.28.0`, integrity checks for fallback binary downloads were added. While intended as an improvement, it was released as a breaking change due to embedding hashes of platform-specific binaries into the top-level `esbuild` package. This also involved an upgrade of the Go compiler from 1.25.7 to 1.26.1, which might introduce subtle behavioral changes in edge cases related to garbage collection and memory allocation.","severity":"breaking","affected_versions":">=0.28.0"},{"fix":"Integrate a separate type-checking step in your build pipeline, such as running `tsc --noEmit` before or after esbuild.","message":"esbuild's TypeScript loader performs transpilation but does *not* do type-checking. For type-checking, you should run `tsc` separately or use a tool like `fork-ts-checker-webpack-plugin` if integrating with Webpack.","severity":"gotcha","affected_versions":">=0.14.0"},{"fix":"If you rely on `import()` expressions, ensure your target environment (e.g., Node.js) correctly handles dynamic `import()` calls in the specified output format. Test your bundled code thoroughly.","message":"Using `import()` expressions in non-ESM output formats (e.g., `cjs`) was previously transformed by esbuild, but `0.27.0` changed this behavior to preserve `import()` expressions. This means `import()` with Node.js is now possible when the output is not ESM, but requires the environment to handle these expressions.","severity":"gotcha","affected_versions":">=0.27.0"},{"fix":"Avoid `using` declarations directly within `case` or `default` clauses in `switch` statements. Refactor your code to place them outside or in a block scope to prevent syntax errors.","message":"The `0.27.2` release, while not explicitly marked as a breaking change in its summary, introduced a change where `using` declarations inside `switch` clauses, previously supported by esbuild, now result in a syntax error. This aligns with a relaxation in the `package.json` spec for import path specifiers starting with `#/`.","severity":"breaking","affected_versions":">=0.27.2"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Run `npm install esbuild` or `yarn add esbuild` in your project directory. Ensure `esbuild` is listed in your `package.json` dependencies.","cause":"The `esbuild` package is not installed, or the Node.js process cannot resolve it.","error":"Error: Cannot find module 'esbuild'"},{"fix":"Verify the module path and extension. You might need to explicitly list common extensions in `resolveExtensions` option, or ensure your `tsconfig.json` paths are correctly configured if using TypeScript aliases.","cause":"esbuild couldn't find a module because of a missing or incorrect file extension, or an incorrect path.","error":"Error: Build failed: [ERROR] Could not resolve \"./my-module\" (use \"--resolve-extensions=.ts,.tsx,.js,.jsx,.json,.mjs,.cjs\" to specify custom extensions)"},{"fix":"Add `format: 'cjs'` or `format: 'esm'` to your esbuild `build` options. Choose based on whether your Node.js project is CommonJS or ES Module-based.","cause":"When targeting `platform: 'node'`, esbuild requires an explicit `format` option of either `'cjs'` (CommonJS) or `'esm'` (ES Modules) to disambiguate module output.","error":"Error: The \"format\" option must be either \"cjs\" or \"esm\" when \"platform\" is \"node\""},{"fix":"Ensure your `package.json` `type` field matches your intended module system (e.g., `\"type\": \"module\"` for ESM). In your esbuild config, set `format: 'esm'` or `format: 'cjs'` to match your target environment. For Node.js, also consider `platform: 'node'`.","cause":"Attempting to use CommonJS `require` syntax in an ES Module context, or ESM `import` in a pure CommonJS context, often due to mismatched `type` in `package.json` or incorrect `format` in esbuild config.","error":"ReferenceError: require is not defined (when using CJS in an ESM context or vice-versa)"}],"ecosystem":"npm","meta_description":null}