{"id":14553,"library":"esbuild-darwin-arm64","title":"esbuild Darwin ARM 64-bit Binary","description":"esbuild is an extremely fast JavaScript bundler and minifier, written in Go and compiled to native code. It is known for its high performance, often outperforming other bundlers by 10-100x, making it ideal for development workflows, build tools, and server-side bundling. The project generally has a rapid release cadence, with the main `esbuild` package currently stable around version `0.28.x` (as indicated by recent changelog entries, though the specific `esbuild-darwin-arm64` binary package provided here is version `0.15.18`). Key differentiators include its speed, low configuration overhead, and ability to handle JavaScript, TypeScript, JSX, TSX, CSS, and image assets. It's often used as a dependency in larger build systems like Vite or directly for CLI bundling tasks. This specific entry pertains to the `esbuild-darwin-arm64` package, which provides the macOS ARM 64-bit binary component for the `esbuild` ecosystem.","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-arm64","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-darwin-arm64","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-darwin-arm64","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary function for bundling files. `esbuild` is primarily an ESM-first package but supports CommonJS `require()` as well. Use named imports for better tree-shaking and clarity in ESM.","wrong":"const esbuild = require('esbuild'); esbuild.build(...)","symbol":"build","correct":"import { build } from 'esbuild'"},{"note":"Used for transforming individual code strings or files without full bundling. Useful for integrating `esbuild` into other tools or loaders that need AST manipulation or specific transpilation.","wrong":"import * as esbuild from 'esbuild'; esbuild.transform(...)","symbol":"transform","correct":"import { transform } from 'esbuild'"},{"note":"For `esbuild` plugin development in Node.js, this function initializes the plugin system, enabling custom behaviors during the build process. Required for any advanced plugin that interacts with the build lifecycle.","symbol":"initializePlugin","correct":"import { initializePlugin } from 'esbuild'"},{"note":"A utility function to format `esbuild` diagnostic messages (errors, warnings) into a human-readable string, useful for custom error reporting in build scripts.","wrong":"import esbuild from 'esbuild'; esbuild.formatMessages(...)","symbol":"formatMessages","correct":"import { formatMessages } from 'esbuild'"}],"quickstart":{"code":"import { build } from 'esbuild';\n\nconst entryPoint = 'src/index.ts';\nconst outputPath = 'dist/bundle.js';\n\nasync function main() {\n  try {\n    const result = await build({\n      entryPoints: [entryPoint],\n      bundle: true,\n      minify: true,\n      sourcemap: true,\n      outfile: outputPath,\n      platform: 'node', // or 'browser', 'neutral'\n      target: 'es2020',\n      logLevel: 'info',\n      plugins: [\n        // Example: A simple plugin that logs file paths before the build starts\n        {\n          name: 'log-paths',\n          setup(build) {\n            build.onStart(() => {\n              console.log(`\nStarting esbuild process for: ${entryPoint}`);\n            });\n            build.onEnd(result => {\n              if (result.errors.length === 0) {\n                console.log(`Build successful: ${outputPath}`);\n              } else {\n                console.error('Build failed with errors:', result.errors);\n              }\n            });\n          },\n        },\n      ],\n    });\n    console.log('esbuild build operation completed.');\n    if (result.warnings.length > 0) {\n        console.warn('Warnings:', result.warnings);\n    }\n  } catch (e) {\n    console.error('An unhandled error occurred during build:', e.message);\n    process.exit(1);\n  }\n}\n\nmain();","lang":"typescript","description":"Demonstrates a basic esbuild bundling operation for a TypeScript entry point, including minification, sourcemaps, targeting a specific platform, and a simple plugin example to log build events."},"warnings":[{"fix":"Update `package.json` to pin `esbuild` to an exact version or use a `~` range. Carefully review the changelog for affected versions and apply necessary code changes.","message":"esbuild v0.27.0 introduced backwards-incompatible changes. Users should always pin the exact version of `esbuild` in `package.json` (e.g., `\"esbuild\": \"0.27.0\"`) or use patch-only version ranges (e.g., `^0.27.0` or `~0.27.0`) to avoid unexpected breakage from minor or major updates. Always review `esbuild`'s release notes for specific migration guides.","severity":"breaking","affected_versions":">=0.27.0"},{"fix":"Prefer installing the main `esbuild` package, which intelligently selects and installs the correct `@esbuild/*` native binary package as a dependency. Avoid directly managing `esbuild-darwin-arm64` unless specifically required by your build setup.","message":"This `esbuild-darwin-arm64` package is a platform-specific binary component. Its version (`0.15.18` provided) might not directly correspond to the latest `esbuild` npm package version (which is currently around `0.28.x` based on the changelog). Installing the main `esbuild` package automatically pulls the correct and compatible binary for your system architecture and `esbuild` version. Direct installation of platform-specific binaries is generally discouraged unless for advanced scenarios, as it can lead to version mismatches or 'No esbuild binary found' errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Carefully configure the `target` option in `build` or `transform` options to precisely match your deployment environment's actual JavaScript capabilities (e.g., `es2015`, `esnext`, `node14`). For TypeScript, ensure class field lowering is appropriate for the target.","message":"When targeting older JavaScript environments, esbuild performs lowering (transpilation) of modern syntax. An incorrectly configured `target` option can lead to unexpected output or runtime errors if the generated code includes features not supported by the specified environment (e.g., class fields for TypeScript parameter properties without appropriate lowering).","severity":"gotcha","affected_versions":"all"},{"fix":"Thoroughly test your build process after any `esbuild` upgrade, especially if you rely on specific CSS output, complex async generators, or advanced import patterns. Review relevant changelog entries for affected versions to understand changes.","message":"Changes in parsing and printing CSS media queries, async generator transformation, and support for new import path specifiers (e.g., `#/` aliases) have been introduced across various minor versions. While often bug fixes or feature additions, these can subtly alter output or behavior if strict parsing rules or specific generator/import patterns are relied upon without testing.","severity":"breaking","affected_versions":">=0.25.11"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you have the main `esbuild` package installed correctly. If issues persist, try `npm rebuild esbuild`, `yarn cache clean && yarn install`, or manually install the correct platform package (e.g., `npm install esbuild-darwin-arm64`). Check if `npm_config_esbuild_binary_path` environment variable is misconfigured.","cause":"The native esbuild binary for the detected platform and architecture (macOS ARM 64-bit) is missing or cannot be located by the `esbuild` package, often due to an incomplete installation or caching issue.","error":"Error: No esbuild binary found for darwin/arm64. Please install the \"esbuild\" package manually."},{"fix":"For ES Modules, use `import { build } from 'esbuild';`. For CommonJS, use `const esbuild = require('esbuild');` and then `esbuild.build(...)`. Ensure your `tsconfig.json` and `package.json` (`\"type\": \"module\"`) are correctly configured for your chosen module system.","cause":"Incorrect import statement (e.g., default import when only named exports exist, or trying to use `require()` on a module that is primarily ESM and not correctly shimmed for CJS).","error":"TypeError: esbuild.build is not a function"},{"fix":"To enable ES module syntax, add `\"type\": \"module\"` to your `package.json`. Alternatively, rename your file to use a `.mjs` extension for ES modules or `.cjs` for CommonJS. If using Node.js, ensure your version supports ESM.","cause":"Attempting to use ES module syntax (e.g., `import`, `export`) in a JavaScript file that is being interpreted as a CommonJS script. This is common when `\"type\": \"module\"` is missing in `package.json` or incorrect file extensions are used.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm"}