forked from TauCetiStation/RViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
58 lines (55 loc) · 1.14 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
import rimraf from "rimraf";
import typescript from '@rollup/plugin-typescript';
import htmlPlugin from "./lib/html";
import nodeResolve from "@rollup/plugin-node-resolve";
import postcss from 'rollup-plugin-postcss';
import { terser } from "rollup-plugin-terser";
import OMT from "@surma/rollup-plugin-off-main-thread";
import {readFileSync} from "fs";
rimraf.sync("dist");
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
input:
{
main: "src/main/index.ts"
},
output: {
dir: "dist",
chunkFileNames: "[name]-[hash].js",
entryFileNames: "[name]-[hash].js",
format: "amd"
},
plugins: [
typescript(),
nodeResolve(),
postcss({
modules: true,
use: ['sass'],
extensions: ['.scss']
}),
OMT(),
htmlPlugin(),
terser(),
{
name: 'files-plugin',
buildStart() {
this.addWatchFile('CNAME');
},
async generateBundle(options, bundle) {
this.emitFile({
fileName: 'CNAME',
type: 'asset',
source: readFileSync('CNAME', 'utf8')
});
this.emitFile({
fileName: 'favicon.ico',
type: 'asset',
source: readFileSync('favicon.ico')
});
}
}
]
};
export default config;