Registry / devops / rollup-plugin-gas

rollup-plugin-gas

JSON →
library1.0.0jsnpmunverified

A Rollup plugin that bundles JavaScript/TypeScript code into a single file compatible with Google Apps Script (GAS). Version 1.0.0 is stable; no release cadence documented. It transpiles imports/exports (ES modules) into a single script with a global namespace, which is required by GAS as it does not support modules natively. Key differentiator: integrates tightly with Rollup's build pipeline. Compared to alternatives like clasp or gas-webpack-plugin, it leverages Rollup's tree-shaking and plugin ecosystem.

npm install rollup-plugin-gas
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-GAS
R
rollup-plugin-gas
devopsjavascriptv1.0.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.

gas
import gas from 'rollup-plugin-gas'
const gas = require('rollup-plugin-gas')
The plugin is ESM-only (no CommonJS export). Use dynamic import if in CommonJS.
gas (default import)
import gas from 'rollup-plugin-gas'
import { gas } from 'rollup-plugin-gas'
The package exports a single default function. Named import will be undefined.
Plugin type
import type { Plugin } from 'rollup'
import { Plugin } from 'rollup-plugin-gas'
No TypeScript types are shipped with this package; use Rollup's own types for the Plugin interface.

Shows how to configure Rollup with rollup-plugin-gas to bundle a JS file for Google Apps Script.

// rollup.config.js import gas from 'rollup-plugin-gas'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'esm' // or 'iife' – rolled into single file }, plugins: [gas()] };
Debug
Known issues
gotchaThe plugin does not support TypeScript natively. You must use @rollup/plugin-typescript or similar before gas().
fix
Add @rollup/plugin-typescript to plugins array before gas().
affects: >=1.0.0
breakingVersion 1.0.0 changed from CommonJS to ESM. require() usage will break.
fix
Use dynamic import() or switch to ESM configuration.
affects: >=1.0.0
gotchaThe plugin only works with Rollup 1.x or higher. Older Rollup versions are incompatible.
fix
Update Rollup to version 1.x or later.
affects: >=1.0.0
gotchaDoes not handle dynamic imports; they are left as-is and will fail at runtime in GAS.
fix
Avoid dynamic import() statements in your source code, or use a different plugin to replace them.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-gas'
Package not installed or incorrect import path.
fix
npm install rollup-plugin-gas --save-dev and ensure import path is 'rollup-plugin-gas'.
TypeError: gas is not a function
Importing as named import instead of default.
fix
Use import gas from 'rollup-plugin-gas' (default import).
Error: Unexpected token 'export'
Using require() with ESM module or not transpiling ES modules before bundling.
fix
Ensure your Rollup config uses format: 'esm' or 'iife', and that you are not using require() in your code.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
rolluprequiredPeer dependency: the plugin requires Rollup >= 1.0.0 to function as a plugin.
magic-stringrequiredUsed for string manipulation to rewrite imports/exports into global assignments.
Agent activity
8 hits · last 30 days
node
6
Resources
rollup-plugin-gas — npm install rollup-plugin-gas · libregistry