-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrollup.config.ts
68 lines (63 loc) · 1.22 KB
/
rollup.config.ts
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
import {resolve, join} from "path";
import {
defaultOutputConfig,
defaultPlugins,
defaultProdPlugins,
defaultServePlugins,
isProd,
isServe
} from "@appnest/web-config";
const folders = {
dist: resolve(__dirname, "dist"),
src: resolve(__dirname, "src/demo"),
src_assets: resolve(__dirname, "src/demo/assets"),
dist_assets: resolve(__dirname, "dist/assets")
};
const files = {
main: join(folders.src, "main.ts"),
src_index: join(folders.src, "index.html"),
dist_index: join(folders.dist, "index.html"),
};
export default {
input: {
main: files.main
},
output: [
defaultOutputConfig({
dir: folders.dist,
format: "esm"
})
],
plugins: [
...defaultPlugins({
cleanConfig: {
targets: [
folders.dist
]
},
copyConfig: {
resources: [
[folders.src_assets, folders.dist_assets]
]
},
htmlTemplateConfig: {
template: files.src_index,
target: files.dist_index,
include: /main(-.*)?\.js$/
},
importStylesConfig: {
globals: ["styles/global.scss"]
}
}),
// Serve
...(isServe ? defaultServePlugins({
dist: folders.dist
}) : []),
// Production
...(isProd ? defaultProdPlugins({
dist: folders.dist
}) : [])
],
treeshake: isProd,
context: "window"
}