Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
GasPlugin
✓ import { GasPlugin } from 'esbuild-gas-plugin'
✗ const GasPlugin = require('esbuild-gas-plugin').GasPlugin
ESM import is preferred. CommonJS require works if using require, but defaults to { GasPlugin }.
GasPlugin (default import)
✓ import GasPlugin from 'esbuild-gas-plugin'
✗ import { default as GasPlugin } from 'esbuild-gas-plugin'
The package has a default export as well. Both named and default imports work identically.
type GasPlugin
✓ import { GasPlugin } from 'esbuild-gas-plugin'
✗ import type { GasPlugin } from 'esbuild-gas-plugin'
GasPlugin is a runtime value (plugin object), not a type. Do not use `import type`.
Minimal setup to bundle a TypeScript entry point for Google Apps Script with esbuild and the gas plugin.
// build.mjs
import { build } from 'esbuild';
import { GasPlugin } from 'esbuild-gas-plugin';
await build({
entryPoints: ['src/index.ts'],
bundle: true,
outfile: 'dist/bundle.js',
plugins: [GasPlugin],
});
console.log('Build complete');
// Run with: node build.mjs
Errors
Common errors & fixes
ERROR: Cannot find module 'esbuild-gas-plugin'
Package not installed or missing from node_modules.
fixRun `npm install -D esbuild-gas-plugin` or your package manager's equivalent.
TypeError: GasPlugin is not a function
Using GasPlugin incorrectly (e.g., calling it as a function instead of passing as an object). GasPlugin is a plugin object, not a factory.
fixUse `plugins: [GasPlugin]` (without invoking).
Error: Build failed with 1 error: error: No matching entry point for format 'esm'
Entry point pattern is not an array or not a string.
fixEnsure entryPoints is an array of strings: `entryPoints: ['src/index.ts']`.
ReferenceError: globalThis is not defined
Using the plugin with an older Node.js version (<12) that does not support globalThis.
fixUpgrade Node.js to version 12 or later.
Audit
Dependencies
esbuildrequiredPeer dependency required to perform the actual bundling. The plugin only provides GAS-specific transformations.