-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.mjs
65 lines (63 loc) · 1.7 KB
/
rollup.config.mjs
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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import typeScript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import postcss from 'rollup-plugin-postcss';
import sourceMaps from 'rollup-plugin-include-sourcemaps';
import postcssImport from 'postcss-import';
import copy from 'rollup-plugin-copy';
const srcDir = 'src'
const buildDir = 'build'
export default args => {
const stamp = !!args.configDev ? 0 : (new Date()).getTime()
return {
input: `${srcDir}/start.js`,
output: {
dir: buildDir,
format: 'iife',
sourcemap: !!args.configDev,
entryFileNames: 'start.js',
globals: {
fs: 'window',
path: 'window',
buffer: 'window',
inspector: 'window',
tty: 'window',
util: 'window',
os: 'window'
}
},
preserveEntrySignatures: false,
plugins: [
resolve(),
json(),
commonjs(),
postcss({
extract: 'assets/start.css',
minimize: !!!args.configDev,
plugins: [postcssImport()]
}),
typeScript({
compilerOptions: {
sourceMap: !!args.configDev,
inlineSources: !!args.configDev,
removeComments: !!!args.configDev
},
include: ['./**/*.ts', './**/*.js']
}),
sourceMaps(),
!!!args.configDev ? terser() : {},
copy({
targets: [{
src: [`./${srcDir}/icons/**/*`, '!**/*.css'],
dest: `./${buildDir}/assets`
}, {
src: `./${srcDir}/winnie.html`,
dest: `./${buildDir}`
}],
copyOnce: true
})
]
}
};