-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
43 lines (42 loc) · 996 Bytes
/
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
import ts from "rollup-plugin-typescript2"
import html from "@rollup/plugin-html"
import postcss from "rollup-plugin-postcss"
import copy from "rollup-plugin-copy"
import { terser } from "rollup-plugin-terser"
import path from "path"
import fs from "fs"
import { fileURLToPath } from "url"
const metaUrl = fileURLToPath(import.meta.url)
const dirName = path.dirname(metaUrl)
export default {
input: "src/index.ts",
output: {
dir: path.resolve(dirName, "dist"),
format: "es",
sourcemap: true
},
plugins: [
ts(),
terser(),
html({
include: "**/*.html",
inject: true,
template: ()=> {
return fs.readFileSync(path.resolve(dirName, 'src/index.html'), 'utf8')
},
fileName: 'index.html'
}),
postcss({
extract: "index.css",
minimize: true,
}),
copy({
targets: [
{
src: 'src/img/*',
dest: 'dist/img/'
}
]
})
]
}