{"id":25614,"library":"gas-build","title":"gas-build","description":"ESBuild plugin and CLI (v0.0.3) for bundling modern TypeScript/JavaScript code into Google App Script (GAS). Combines ESBuild bundling with transformations required by GAS runtime (e.g., handling of `google.script.run`, `ScriptApp`). Peer dependency on `esbuild` ^0.24.2. Differentiator: no need for separate GAS-specific transpilation steps; single pass via ESBuild plugin. Actively maintained by Salsita.","status":"active","version":"0.0.3","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/salsita/gas-build","tags":["javascript","typescript"],"install":[{"cmd":"npm install gas-build","lang":"bash","label":"npm"},{"cmd":"yarn add gas-build","lang":"bash","label":"yarn"},{"cmd":"pnpm add gas-build","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; provides the core bundler","package":"esbuild","optional":false}],"imports":[{"note":"This is a named export, not a default export.","wrong":"import gasBuildPlugin from 'gas-build'","symbol":"gasBuildPlugin","correct":"import { gasBuildPlugin } from 'gas-build'"},{"note":"For CommonJS, destructure the named export. Do not use .default.","wrong":"const gasBuildPlugin = require('gas-build').default","symbol":"gasBuildPlugin","correct":"const { gasBuildPlugin } = require('gas-build')"},{"note":"Preferred method: use npx or a script in package.json. Avoid calling the binary directly.","wrong":"node ./node_modules/.bin/gas-build src/index.ts --outfile dist/bundle.js","symbol":"CLI","correct":"npx gas-build src/index.ts --outfile dist/bundle.js"}],"quickstart":{"code":"// build script: build.mjs\nimport { build } from 'esbuild';\nimport { gasBuildPlugin } from 'gas-build';\n\nawait build({\n  entryPoints: ['src/index.ts'],\n  bundle: true,\n  outfile: 'dist/bundle.js',\n  platform: 'node',\n  target: 'es2020',\n  format: 'esm',\n  plugins: [gasBuildPlugin()],\n});\n\n// Run with: node build.mjs","lang":"typescript","description":"Bundles a TypeScript entry point into a single file for Google App Script using the ESBuild plugin."},"warnings":[{"fix":"Always use `outfile` instead of `outdir` when using the plugin.","message":"Options like `outdir` (instead of `outfile`) may not be supported; plugin expects a single output file.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Set `format: 'esm'` or omit to default to 'iife' (GAS compatible). Avoid 'cjs'.","message":"The plugin does not warn if `format` is missing. If set incorrectly, output may not work in GAS runtime.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Run `npm install -D gas-build esbuild`.","message":"ESBuild must be installed as a separate peer dependency. The package does not include it.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin to latest version and test build after update.","message":"Version 0.0.3 may have breaking changes from earlier 0.0.x versions; no changelog provided.","severity":"breaking","affected_versions":"<0.0.3"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add `google` to the `define` option in ESBuild config (e.g., `define: { 'google': '{}' }`), or use the plugin's built-in handling.","cause":"The plugin expects GAS-specific globals to be used as such; ESBuild does not resolve them.","error":"Error: Build failed with 1 error: ... Could not resolve 'google.script.run'"},{"fix":"Use `import { gasBuildPlugin } from 'gas-build'`.","cause":"Importing default export instead of named export.","error":"TypeError: gasBuildPlugin is not a function"},{"fix":"Run `npm install -D gas-build esbuild`.","cause":"Package not installed or node_modules not present.","error":"Error: Cannot find module 'gas-build'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}