{"id":22035,"library":"rollup-plugin-gas","title":"rollup-plugin-gas","description":"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.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/Tosuke/rollup-plugin-gas","tags":["javascript","rollup-plugin","es2015","google-apps-script"],"install":[{"cmd":"npm install rollup-plugin-gas","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-gas","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-gas","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: the plugin requires Rollup >= 1.0.0 to function as a plugin.","package":"rollup","optional":false},{"reason":"Used for string manipulation to rewrite imports/exports into global assignments.","package":"magic-string","optional":false}],"imports":[{"note":"The plugin is ESM-only (no CommonJS export). Use dynamic import if in CommonJS.","wrong":"const gas = require('rollup-plugin-gas')","symbol":"gas","correct":"import gas from 'rollup-plugin-gas'"},{"note":"The package exports a single default function. Named import will be undefined.","wrong":"import { gas } from 'rollup-plugin-gas'","symbol":"gas (default import)","correct":"import gas from 'rollup-plugin-gas'"},{"note":"No TypeScript types are shipped with this package; use Rollup's own types for the Plugin interface.","wrong":"import { Plugin } from 'rollup-plugin-gas'","symbol":"Plugin type","correct":"import type { Plugin } from 'rollup'"}],"quickstart":{"code":"// rollup.config.js\nimport gas from 'rollup-plugin-gas';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm' // or 'iife' – rolled into single file\n  },\n  plugins: [gas()]\n};","lang":"javascript","description":"Shows how to configure Rollup with rollup-plugin-gas to bundle a JS file for Google Apps Script."},"warnings":[{"fix":"Add @rollup/plugin-typescript to plugins array before gas().","message":"The plugin does not support TypeScript natively. You must use @rollup/plugin-typescript or similar before gas().","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use dynamic import() or switch to ESM configuration.","message":"Version 1.0.0 changed from CommonJS to ESM. require() usage will break.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Update Rollup to version 1.x or later.","message":"The plugin only works with Rollup 1.x or higher. Older Rollup versions are incompatible.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid dynamic import() statements in your source code, or use a different plugin to replace them.","message":"Does not handle dynamic imports; they are left as-is and will fail at runtime in GAS.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install rollup-plugin-gas --save-dev and ensure import path is 'rollup-plugin-gas'.","cause":"Package not installed or incorrect import path.","error":"Error: Cannot find module 'rollup-plugin-gas'"},{"fix":"Use import gas from 'rollup-plugin-gas' (default import).","cause":"Importing as named import instead of default.","error":"TypeError: gas is not a function"},{"fix":"Ensure your Rollup config uses format: 'esm' or 'iife', and that you are not using require() in your code.","cause":"Using require() with ESM module or not transpiling ES modules before bundling.","error":"Error: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}