Registry / gcp / esbuild-gas-plugin

esbuild-gas-plugin

JSON →
library0.10.0jsnpmunverified

esbuild plugin for Google Apps Script that bundles TypeScript/JavaScript into a single file compatible with the GAS runtime. Current version 0.10.0, actively maintained with frequent releases. Key differentiators: supports both Rhino and V8 runtimes, works with Node.js and Deno, generates JSDoc annotations for better GAS autocompletion, and is inspired by gas-webpack-plugin but leverages esbuild's faster build times.

npm install esbuild-gas-plugin
INSTALL
IMPORT
SIG · ESBUILD-GAS-PLUGIN
E
esbuild-gas-plugin
gcpjavascriptv0.10.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18223 runs
build_error
glibc
node 18223 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
Debug
Known issues
breakingIn v0.9.0, support for the Rhino engine was added. Existing builds targeting V8 may need to check compatibility if they use Rhino-specific features.
fix
Ensure your GAS project uses V8 runtime or test accordingly.
affects: >=0.9.0
deprecatedThe plugin previously used a 'use export' pattern in v0.4.0 but now defaults to JSDoc generation. Scripts relying on the old export style may break.
fix
Upgrade to 0.10.0 and verify output format.
affects: <0.4.0
gotchaEntry points must be an array of strings, but only the first element is used. Providing multiple entries will not bundle them together as expected.
fix
Use a single entry point file that imports other modules.
affects: >=0.0.0
gotchaWhen using the plugin with Deno, you must import from 'npm:esbuild-gas-plugin@0.7.0' (or later). Older versions may not work with Deno.
fix
Use at least version 0.7.0 for Deno compatibility.
affects: <0.7.0
Errors
Common errors & fixes
ERROR: Cannot find module 'esbuild-gas-plugin'
Package not installed or missing from node_modules.
fix
Run `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.
fix
Use `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.
fix
Ensure 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.
fix
Upgrade Node.js to version 12 or later.
Upgrade
Version history
0.10.0latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency required to perform the actual bundling. The plugin only provides GAS-specific transformations.
Agent activity
28 hits · last 30 days
node
21
OpenAI (training)
1
Resources
esbuild-gas-plugin — npm install esbuild-gas-plugin · libregistry