{"id":22045,"library":"rollup-plugin-google-apps-script","title":"rollup-plugin-google-apps-script","description":"Rollup plugin for Google Apps Script that generates top-level function declarations from global object assignments, enabling local development with modern bundlers and deployment via clasp. Current stable version 2.0.2, with support for Rollup ^3.25.0 || ^4.0.0 and Vite ^4.4.9. Maintained by mato533, inspired by gas-webpack-plugin. Releases are occasional; latest includes dependency updates and gas-entry-generator options. Key differentiators: works with both Rollup and Vite, generates GAS-compatible bundle structure, supports TypeScript out of the box.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/mato533/rollup-plugin-gas","tags":["javascript","rollup","plugin","rollup-plugin","Google Apps Script","google-apps-scripts","typescript"],"install":[{"cmd":"npm install rollup-plugin-google-apps-script","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-google-apps-script","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-google-apps-script","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: required as the bundler that the plugin extends.","package":"rollup","optional":false},{"reason":"Peer dependency: required when using with Vite; optional if only Rollup is used.","package":"vite","optional":true}],"imports":[{"note":"ESM-only module; does not provide a CommonJS export. Use import syntax.","wrong":"const gasPlugin = require('rollup-plugin-google-apps-script')","symbol":"gasPlugin","correct":"import gasPlugin from 'rollup-plugin-google-apps-script'"},{"note":"Default export only; named export gasPlugin does not exist.","wrong":"import { gasPlugin } from 'rollup-plugin-google-apps-script'","symbol":"gasPlugin","correct":"import gasPlugin from 'rollup-plugin-google-apps-script'"},{"note":"TypeScript type export; use type-only import to avoid runtime errors.","wrong":"import { GasPluginOptions } from 'rollup-plugin-google-apps-script'","symbol":"GasPluginOptions","correct":"import type { GasPluginOptions } from 'rollup-plugin-google-apps-script'"}],"quickstart":{"code":"import gasPlugin from 'rollup-plugin-google-apps-script';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  plugins: [\n    gasPlugin({\n      include: ['**/*.js'],\n      moduleHeaderComment: true,\n      manifest: {\n        copy: true,\n        srcDir: 'src',\n      },\n      gasEntryOptions: {\n        comment: true,\n        autoGlobalExports: false,\n        exportsIdentifierName: 'exports',\n        globalIdentifierName: 'global',\n      },\n      verbose: true,\n    }),\n  ],\n  build: {\n    outDir: 'dist',\n    rollupOptions: {\n      input: 'src/main.js',\n      output: {\n        format: 'esm',\n        entryFileNames: 'bundle.js',\n      },\n    },\n  },\n});","lang":"typescript","description":"Configures Vite with the gas plugin, setting input file, output directory, and GAS-specific options like manifest copy and entry generator settings."},"warnings":[{"fix":"Move comment option under gasEntryOptions.comment; see migration guide.","message":"Major version v2.0.0 introduces gasEntryOptions and restructures option object; old top-level options like comment are deprecated.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use gasEntryOptions.comment instead.","message":"The top-level 'comment' option is deprecated in v2.0.0.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure all GAS-entry functions are assigned as global.property = ...","message":"Plugin generates top-level function declarations only for assignments to a property of the 'global' object (e.g., global.myFunc = ...). Other patterns are ignored.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import gasPlugin from 'rollup-plugin-google-apps-script'","message":"Requires import using ESM syntax; CommonJS require() will throw an error (module not found).","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Upgrade Vite to ^4.4.9 or later.","message":"When using Vite, ensure Vite version ^4.4.9 is used; older versions may have compatibility issues.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use import gasPlugin from 'rollup-plugin-google-apps-script'","cause":"CommonJS require() used instead of ESM import.","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'rollup-plugin-google-apps-script'"},{"fix":"Use import gasPlugin from 'rollup-plugin-google-apps-script' (not import { gasPlugin })","cause":"Named import used instead of default import.","error":"TypeError: gasPlugin is not a function"},{"fix":"Ensure assignment is like global.myFunc = () => {} and include pattern covers the file.","cause":"Function not assigned as global.property, or file not included in the include pattern.","error":"You assigned to global but no top-level function was generated"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}