forked from lichess-org/lichobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
59 lines (57 loc) · 1.33 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
import path from 'path'
import alias from '@rollup/plugin-alias'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import strip from '@rollup/plugin-strip'
import { terser } from 'rollup-plugin-terser'
import visualizer from 'rollup-plugin-visualizer'
const release = process.env.APP_MODE === 'release'
const projectRootDir = path.resolve(__dirname)
export default [{
input: 'build/main.js',
preserveEntrySignatures: false,
output: {
dir: 'www',
format: 'esm',
sourcemap: !release,
},
plugins: [
alias({
entries: [
{
// see path mapping in tsconfig.json
find: /^~/,
replacement: path.resolve(projectRootDir, 'build')
}
],
}),
resolve(),
commonjs(),
json(),
release && strip({
debugger: true,
sourceMap: false,
}),
release && terser(),
visualizer(),
],
onwarn(warning, warn) {
if (warning.code === 'CIRCULAR_DEPENDENCY') return
if ( warning.code === 'THIS_IS_UNDEFINED' ) return
warn(warning)
}
}, {
input: 'build/socketWorker/index.js',
output: {
file: 'www/socketWorker.js',
format: 'iife',
},
plugins: [
release && strip({
debugger: true,
sourceMap: false,
}),
release && terser(),
]
}]