Registry / devops / gas-build

gas-build

JSON →
library0.0.3jsnpmunverified

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.

npm install gas-build
INSTALL
IMPORT
SIG · GAS-BUILD
G
gas-build
devopsjavascriptv0.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gasBuildPlugin
import { gasBuildPlugin } from 'gas-build'
import gasBuildPlugin from 'gas-build'
This is a named export, not a default export.
gasBuildPlugin
const { gasBuildPlugin } = require('gas-build')
const gasBuildPlugin = require('gas-build').default
For CommonJS, destructure the named export. Do not use .default.
CLI
npx gas-build src/index.ts --outfile dist/bundle.js
node ./node_modules/.bin/gas-build src/index.ts --outfile dist/bundle.js
Preferred method: use npx or a script in package.json. Avoid calling the binary directly.

Bundles a TypeScript entry point into a single file for Google App Script using the ESBuild plugin.

// build script: build.mjs import { build } from 'esbuild'; import { gasBuildPlugin } from 'gas-build'; await build({ entryPoints: ['src/index.ts'], bundle: true, outfile: 'dist/bundle.js', platform: 'node', target: 'es2020', format: 'esm', plugins: [gasBuildPlugin()], }); // Run with: node build.mjs
gas-build --version
Debug
Known issues
deprecatedOptions like `outdir` (instead of `outfile`) may not be supported; plugin expects a single output file.
fix
Always use `outfile` instead of `outdir` when using the plugin.
affects: >=0.0.0
gotchaThe plugin does not warn if `format` is missing. If set incorrectly, output may not work in GAS runtime.
fix
Set `format: 'esm'` or omit to default to 'iife' (GAS compatible). Avoid 'cjs'.
affects: >=0.0.0
gotchaESBuild must be installed as a separate peer dependency. The package does not include it.
fix
Run `npm install -D gas-build esbuild`.
affects: >=0.0.0
breakingVersion 0.0.3 may have breaking changes from earlier 0.0.x versions; no changelog provided.
fix
Pin to latest version and test build after update.
affects: <0.0.3
Errors
Common errors & fixes
Error: Build failed with 1 error: ... Could not resolve 'google.script.run'
The plugin expects GAS-specific globals to be used as such; ESBuild does not resolve them.
fix
Add `google` to the `define` option in ESBuild config (e.g., `define: { 'google': '{}' }`), or use the plugin's built-in handling.
TypeError: gasBuildPlugin is not a function
Importing default export instead of named export.
fix
Use `import { gasBuildPlugin } from 'gas-build'`.
Error: Cannot find module 'gas-build'
Package not installed or node_modules not present.
fix
Run `npm install -D gas-build esbuild`.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency; provides the core bundler
Agent activity
4 hits · last 30 days
node
4
Resources
gas-build — npm install gas-build · libregistry