-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathrollup.config.mjs
58 lines (56 loc) · 1.5 KB
/
rollup.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { babel } from "@rollup/plugin-babel"
import commonjs from "@rollup/plugin-commonjs"
import json from "@rollup/plugin-json"
import resolve from "@rollup/plugin-node-resolve"
import replace from "@rollup/plugin-replace"
import terser from "@rollup/plugin-terser"
import typescript from "@rollup/plugin-typescript"
import fs from "fs"
import { defineConfig } from "rollup"
import analyzer from "rollup-plugin-analyzer"
import gas from "rollup-plugin-google-apps-script"
import { visualizer } from "rollup-plugin-visualizer"
const pkg = JSON.parse(fs.readFileSync("./package.json", "utf-8"))
export default defineConfig({
context: "globalThis",
input: "./build/lib/index.js",
output: {
file: "./build/gas/lib/GmailProcessorLib.js",
format: "iife",
name: "GmailProcessorLib",
},
plugins: [
replace({
preventAssignment: true,
values: {
__PACKAGE_DESCRIPTION__: pkg.description,
__PACKAGE_NAME__: pkg.name,
__PACKAGE_VERSION__: pkg.version,
},
}),
json(),
resolve({
//preferBuiltins: false,
// browser: true, // Required to activate polyfills for Google Apps Script
}),
commonjs(),
typescript(),
babel({ babelHelpers: "bundled" }),
gas({
gasEntryOptions: {
comment: false,
},
moduleHeaderComment: true,
}),
analyzer({
summaryOnly: true,
limit: 5,
}),
terser({
compress: true,
}),
visualizer({
filename: "build/bundle-stats.html",
}),
],
})