This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
85 lines (82 loc) · 1.62 KB
/
rollup.config.js
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import rimraf from "rimraf";
import typescript from '@rollup/plugin-typescript';
import htmlPlugin from "./lib/html.js";
import nodeResolve from "@rollup/plugin-node-resolve";
import pnpResolve from "rollup-plugin-pnp-resolve";
import postcss from 'rollup-plugin-postcss';
import terser from "@rollup/plugin-terser";
import {readFileSync} from "fs";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
rimraf.sync("dist");
/**
* @type {import('rollup').RollupOptions}
*/
const config = [
{
input: "src/client/browserfill.ts",
output: {
dir: "dist/res",
entryFileNames: "[name].js",
format: "iife",
},
plugins: [
typescript(),
terser()
]
},
{
input:
{
main: "src/client/index.ts"
},
output: {
dir: "dist/res",
chunkFileNames: "[name]-[hash].js",
entryFileNames: "[name]-[hash].js",
format: "iife"
},
plugins: [
typescript(),
pnpResolve(),
nodeResolve(),
postcss(),
//OMT(),
htmlPlugin(),
terser(),
{
name: 'files-plugin',
buildStart() {
this.addWatchFile('CNAME');
},
async generateBundle(options, bundle) {
this.emitFile({
fileName: 'favicon.ico',
type: 'asset',
source: readFileSync('favicon.ico')
});
}
}
]
},{
input:
{
proxy: "src/proxy/index.ts"
},
output: {
dir: "dist",
chunkFileNames: "[name]-[hash].js",
entryFileNames: "[name].js",
format: "esm"
},
plugins: [
typescript(),
json(),
pnpResolve(),
nodeResolve(),
commonjs()
],
external: ["express", "openid-client", "ws","node-fetch", "ip-matching"]
}
];
export default config;