-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
62 lines (56 loc) · 1.3 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
import commonjs from "@rollup/plugin-commonjs";
import {dependencies} from "./package.json";
import json from "@rollup/plugin-json";
import nodeResolve from "@rollup/plugin-node-resolve";
import remove from "rollup-plugin-delete";
import {resolve} from "path";
import {terser} from "rollup-plugin-terser";
import typescript from "@rollup/plugin-typescript";
import copy from "rollup-plugin-copy";
const config = {
plugins: [
nodeResolve(),
commonjs(),
json(),
typescript({
noEmitOnError: false
}),
"production" === process.env.NODE_ENV && terser({
compress: {
drop_console: true
}
}),
copy({
targets: [
{src: "public/css/app.css", dest: "dist/css"},
{src: "public/index.html", dest: "dist/"},
{src: "public/static/**/*", dest: "dist/static"}
]
})
],
external: [...Object.keys(dependencies), "stream", 'node:fs/promises', 'node:path'],
}
export default [
{
...config,
input: resolve("src/api", "server.ts"),
plugins: [
...config.plugins,
remove({targets: resolve("dist"), runOnce: true, verbose: true})
],
output: {
file: resolve("dist/api", "server.js"),
format: "cjs",
sourcemap: true
}
},
{
...config,
input: resolve("src/client", "app.ts"),
output: {
file: resolve("dist/js", "app.js"),
format: "cjs",
sourcemap: true
}
}
];