{"id":21227,"library":"esbuild-gas-plugin","title":"esbuild-gas-plugin","description":"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.","status":"active","version":"0.10.0","language":"javascript","source_language":"en","source_url":"https://github.com/mahaker/esbuild-gas-plugin","tags":["javascript","esbuild","apps-script","google-apps-script","typescript"],"install":[{"cmd":"npm install esbuild-gas-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-gas-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-gas-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to perform the actual bundling. The plugin only provides GAS-specific transformations.","package":"esbuild","optional":false}],"imports":[{"note":"ESM import is preferred. CommonJS require works if using require, but defaults to { GasPlugin }.","wrong":"const GasPlugin = require('esbuild-gas-plugin').GasPlugin","symbol":"GasPlugin","correct":"import { GasPlugin } from 'esbuild-gas-plugin'"},{"note":"The package has a default export as well. Both named and default imports work identically.","wrong":"import { default as GasPlugin } from 'esbuild-gas-plugin'","symbol":"GasPlugin (default import)","correct":"import GasPlugin from 'esbuild-gas-plugin'"},{"note":"GasPlugin is a runtime value (plugin object), not a type. Do not use `import type`.","wrong":"import type { GasPlugin } from 'esbuild-gas-plugin'","symbol":"type GasPlugin","correct":"import { GasPlugin } from 'esbuild-gas-plugin'"}],"quickstart":{"code":"// build.mjs\nimport { build } from 'esbuild';\nimport { GasPlugin } from 'esbuild-gas-plugin';\n\nawait build({\n  entryPoints: ['src/index.ts'],\n  bundle: true,\n  outfile: 'dist/bundle.js',\n  plugins: [GasPlugin],\n});\nconsole.log('Build complete');\n\n// Run with: node build.mjs","lang":"typescript","description":"Minimal setup to bundle a TypeScript entry point for Google Apps Script with esbuild and the gas plugin."},"warnings":[{"fix":"Ensure your GAS project uses V8 runtime or test accordingly.","message":"In 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.","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Upgrade to 0.10.0 and verify output format.","message":"The 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.","severity":"deprecated","affected_versions":"<0.4.0"},{"fix":"Use a single entry point file that imports other modules.","message":"Entry points must be an array of strings, but only the first element is used. Providing multiple entries will not bundle them together as expected.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use at least version 0.7.0 for Deno compatibility.","message":"When 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.","severity":"gotcha","affected_versions":"<0.7.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install -D esbuild-gas-plugin` or your package manager's equivalent.","cause":"Package not installed or missing from node_modules.","error":"ERROR: Cannot find module 'esbuild-gas-plugin'"},{"fix":"Use `plugins: [GasPlugin]` (without invoking).","cause":"Using GasPlugin incorrectly (e.g., calling it as a function instead of passing as an object). GasPlugin is a plugin object, not a factory.","error":"TypeError: GasPlugin is not a function"},{"fix":"Ensure entryPoints is an array of strings: `entryPoints: ['src/index.ts']`.","cause":"Entry point pattern is not an array or not a string.","error":"Error: Build failed with 1 error: error: No matching entry point for format 'esm'"},{"fix":"Upgrade Node.js to version 12 or later.","cause":"Using the plugin with an older Node.js version (<12) that does not support globalThis.","error":"ReferenceError: globalThis is not defined","affected_versions":">=0.0.0"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}