esbuild Linux ARM Binary
This package, `esbuild-linux-arm`, is a platform-specific binary component for esbuild, an extremely fast JavaScript and CSS bundler and minifier. The main `esbuild` package (currently at v0.28.0) automatically installs the correct platform-specific binary, making this package an indirect dependency for most users. esbuild is renowned for its exceptional speed, often performing builds 10 to 100 times faster than alternatives like Webpack or Rollup, attributed to its implementation in Go, extensive parallelism, and optimized algorithms. It maintains a sustainable and active release cadence, with frequent updates addressing bugs, introducing new features, and incorporating JavaScript specification changes. Key differentiators include its high performance, minimal configuration, built-in support for TypeScript and JSX transformation, and a growing plugin ecosystem.
Common errors
-
✘ [ERROR] Could not resolve "some-module"
cause esbuild could not find the imported module in `node_modules` or the specified paths.fixEnsure the module is installed (`npm install some-module`), spelled correctly, and check your `resolve` options in esbuild configuration. If it's a Node.js built-in module, ensure `platform: 'node'` is set. -
✘ [ERROR] Expected ";" but found "}"
cause There is a syntax error in your JavaScript or TypeScript code.fixReview the file and line number indicated in the error message for incorrect syntax. Use a linter (like ESLint) to catch these errors before running esbuild. -
error: Promise resolution is still pending but the event loop has already resolved
cause This error can occur in Deno when esbuild's long-lived child process is not explicitly terminated after `esbuild.stop()` is called, particularly with Deno's testing API.fixEnsure `esbuild.stop()` is properly called and awaited, or investigate specific Deno runtime issues related to child process handling, especially after Deno 1.40.0. -
ERROR: your schema was not successfully built / ERROR: your config.{ts,js} was not successfully executedcause Often seen in frameworks using esbuild internally (e.g., TinaCMS), this indicates a syntax/semantic error in the configuration file or an imported file, or attempting to run frontend-specific code (e.g., using `window`) in a Node.js environment during the build process.fixInspect the mentioned configuration file and its imports for syntax errors or accidental inclusion of browser-specific code. Refactor imports to be more granular, importing only what's strictly needed for the build environment.
Warnings
- breaking esbuild explicitly ships backwards-incompatible changes in minor versions (e.g., v0.27.0, v0.24.0, v0.23.0). It is crucial to pin exact versions or use only patch-level ranges (`~0.X.Y`) in `package.json` to prevent unexpected build failures upon upgrade.
- gotcha When bundling for Node.js, `esbuild` does not automatically externalize Node.js built-in modules (like `fs`, `path`, `https`) by default unless `--platform=node` is explicitly set. Without this, it will attempt to bundle them, leading to errors like 'Could not resolve "https"'.
- breaking esbuild's JavaScript API increased its minimum required Node.js version from 12 to 18 in a 2024 release. Running `esbuild` via its JS API on older Node.js versions will result in incompatibility errors.
- gotcha esbuild treats TypeScript types as comments and strips them without performing type checking. This means type errors will not halt the esbuild process. It is recommended to enable the `isolatedModules` TypeScript compiler option.
- breaking The behavior of TypeScript parameter properties and class fields changed in v0.27.7, specifically regarding their lowering when the target environment does not support class fields. Previous versions might have incorrectly generated class fields, leading to runtime issues.
- breaking Support for macOS 10.15 Catalina was dropped in a 2024 release (v0.24.0) because the Go programming language (which esbuild is written in) dropped support for it. This affects users running older macOS versions.
Install
-
npm install esbuild-linux-arm -
yarn add esbuild-linux-arm -
pnpm add esbuild-linux-arm
Imports
- build
const { build } = require('esbuild')import { build } from 'esbuild' - transform
import esbuild from 'esbuild'; esbuild.transform(...)
import { transform } from 'esbuild' - ServeOptions
import { ServeOptions } from 'esbuild'import type { ServeOptions } from 'esbuild'
Quickstart
import { build } from 'esbuild';
import path from 'path';
import url from 'url';
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
async function bundleCode() {
try {
await build({
entryPoints: [path.resolve(__dirname, 'src/index.ts')],
bundle: true,
minify: true,
sourcemap: true,
outfile: path.resolve(__dirname, 'dist/bundle.js'),
platform: 'node',
target: 'es2020',
logLevel: 'info',
});
console.log('Build successful: dist/bundle.js created.');
} catch (error) {
console.error('Build failed:', error);
process.exit(1);
}
}
bundleCode();
// To make this runnable, create src/index.ts:
// export function greet(name: string): string {
// return `Hello, ${name}!`;
// }
// console.log(greet('esbuild user'));