
clasp 3 Dropped TypeScript — Here's a Vite Plugin for Google Apps Script
Write standard TypeScript with export . Build with Vite. Push with clasp. Why I built this clasp 3 removed built-in TypeScript support. The recommendation is to use an external bundler — Google provides google/aside for Rollup. I wanted Vite. The existing Vite plugins for GAS were either outdated (Rhino-era transforms like arrow function conversion) or didn't support web apps. So I built gas-vite-plugin — a minimal Vite plugin that only does what Vite can't do natively for GAS. Install npm install -D gas-vite-plugin Basic usage // vite.config.ts import gasPlugin from " gas-vite-plugin " ; import { defineConfig } from " vite " ; export default defineConfig ({ plugins : [ gasPlugin ()], build : { lib : { entry : " src/main.ts " , formats : [ " es " ], fileName : () => " Code.js " , }, }, }); // src/main.ts export function onOpen () { SpreadsheetApp . getUi () . createMenu ( " My Menu " ) . addItem ( " Run " , " myFunction " ) . addToUi (); } export function myFunction () { SpreadsheetApp
Continue reading on Dev.to Webdev
Opens in a new tab


