esbuild Linux MIPS64LE Native Binary
esbuild is an extremely fast JavaScript bundler and minifier, primarily developed in Go, excelling at processing JavaScript, TypeScript, JSX, CSS, JSON, and other web assets with remarkable speed. It's a popular choice for accelerating build pipelines and development server hot-reloading due to its performance. The project maintains a rapid release cadence, with frequent minor and patch updates, alongside occasional major releases that may introduce significant new features or breaking changes. This specific package, `esbuild-linux-mips64le`, provides the pre-compiled native binary for Linux MIPS 64-bit Little Endian architectures. It serves as a critical runtime dependency for the main `esbuild` npm package when installed on compatible MIPS64LE systems, enabling the JavaScript wrapper to execute the native bundler logic. While this binary package is at version `0.15.18`, the current stable version of the core `esbuild` package is `0.20.24`.
Common errors
-
Error: No matching esbuild binary found for this platform.
cause The esbuild JavaScript wrapper could not find or execute its corresponding native binary for the detected operating system and architecture.fixEnsure you have installed the main `esbuild` package, allowing it to select the correct platform-specific binary. If cross-compiling or using a non-standard environment, verify that the correct `esbuild-xxx-yyy` package is installed and accessible, or specify the binary path via environment variables. -
ReferenceError: require is not defined in ES module scope
cause Attempting to use CommonJS `require()` syntax in a JavaScript file that Node.js or esbuild is interpreting as an ES Module.fixFor ES Modules, use `import` statements instead of `require()`. Ensure your `package.json` has `"type": "module"` if you intend for `.js` files to be ESM, or configure esbuild's `format` option (e.g., `esm` or `cjs`) to match your target environment. Conversely, if targeting CJS, avoid top-level `import` statements. -
Could not resolve 'module-name'
cause esbuild failed to locate an imported module, often due to a missing `node_modules` dependency, an incorrect relative path, or an unconfigured path alias.fixVerify that the dependency is installed (`npm install module-name` or `yarn add module-name`). Check the import path for correctness. If using path aliases (e.g., in `tsconfig.json`), ensure esbuild is configured to interpret them, potentially via an esbuild plugin or by pointing esbuild to your `tsconfig.json`.
Warnings
- breaking esbuild v0.27.0 introduced deliberate backwards-incompatible changes. To prevent unexpected build failures or behavior, it is strongly recommended to pin the exact version of `esbuild` in your `package.json` (e.g., `"esbuild": "0.20.24"`) or use a patch-only version range (`~0.20.0`).
- gotcha This package (`esbuild-linux-mips64le`) is a platform-specific native binary. Users should typically install the main `esbuild` package, which automatically detects and installs the correct binary for the host system. Directly installing this package is only for specific cross-compilation or advanced use cases and can lead to 'No matching esbuild binary found' errors if installed on an incompatible platform.
- gotcha esbuild's JavaScript wrapper requires Node.js version 12 or higher. Attempting to run esbuild with older Node.js versions may result in execution errors or unexpected behavior.
Install
-
npm install esbuild-linux-mips64le -
yarn add esbuild-linux-mips64le -
pnpm add esbuild-linux-mips64le
Imports
- build
const { build } = require('esbuild')import { build } from 'esbuild' - transform
const esbuild = require('esbuild'); esbuild.transform(code)import { transform } from 'esbuild' - formatMessages
import esbuild from 'esbuild'; esbuild.formatMessages(...)
import { formatMessages } from 'esbuild'
Quickstart
import { build } from 'esbuild';
import path from 'node:path';
import process from 'node:process';
import { writeFileSync, mkdirSync } from 'node:fs';
const entryPoint = 'src/index.ts';
const outputDir = 'dist';
const outputFileName = 'bundle.js';
// Create dummy entry points for the quickstart
mkdirSync('src', { recursive: true });
writeFileSync(entryPoint, `
import { add } from './utils';
console.log('Hello from esbuild!');
console.log('2 + 3 =', add(2, 3));
`);
writeFileSync('src/utils.ts', `
export function add(a: number, b: number): number {
return a + b;
}
`);
async function runBuild() {
try {
await build({
entryPoints: [entryPoint],
bundle: true,
minify: process.env.NODE_ENV === 'production',
sourcemap: process.env.NODE_ENV !== 'production',
outfile: path.join(outputDir, outputFileName),
platform: 'node', // Can be 'browser', 'node', or 'neutral'
target: 'es2022',
logLevel: 'info',
// Example plugin usage:
// plugins: [{
// name: 'example',
// setup(build) {
// build.onResolve({ filter: /\./ }, args => {
// if (args.path === 'foo') return { path: args.path, namespace: 'foo-ns' };
// });
// build.onLoad({ filter: /foo/, namespace: 'foo-ns' }, () => ({
// contents: 'export default "bar";',
// loader: 'js',
// }));
// },
// }],
});
console.log(`Build successful: ${path.join(outputDir, outputFileName)}`);
} catch (e) {
console.error('Build failed:', e);
process.exit(1);
}
}
runBuild();