Skip to content

mahaker/esbuild-gas-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esbuild-gas-plugin

npm version test

esbuild plugin for Google Apps Script.

This is inspired by gas-webpack-plugin.

Install

npm install -D esbuild-gas-plugin
// or
yarn add -D esbuild-gas-plugin
// or
pnpm add -D esbuild-gas-plugin

Usage

Add this to Your build script file, and paste dist/bundle.js to script editor.

A simple example can be found in here.

Node

// build.js
const { GasPlugin } = require('esbuild-gas-plugin');

require('esbuild').build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  outfile: 'dist/bundle.js',
  plugins: [GasPlugin]
}).catch((e) => {
  console.error(e)
  process.exit(1)
})

and

node build.js

Deno

// build.ts
import { build, stop } from 'https://deno.land/x/[email protected]/mod.js'
import { GasPlugin } from 'npm:[email protected]'
import httpFetch from 'https://deno.land/x/[email protected]/index.js'

await build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  outfile: 'dist/bundle.js',
  plugins: [httpFetch, GasPlugin ]
})
stop()

and

deno run --allow-read --allow-env --allow-run --allow-write build.ts
# or
deno run -A build.ts