-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
46 lines (44 loc) · 1.13 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
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import esbuild from 'rollup-plugin-esbuild'
import html from 'rollup-plugin-html-bundle'
import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload'
import kontra from 'rollup-plugin-kontra'
import { terser } from 'rollup-plugin-terser'
const prod = process.env.NODE_ENV === 'production'
export default {
input: 'src/index.ts',
output: {
file: 'dist/bundle.js',
format: 'esm',
},
plugins: [
kontra({
gameObject: { velocity: true, anchor: true, group: true, ttl: true },
sprite: { animation: false },
text: { textAlign: true, newline: true },
vector: {
add: true,
dot: true,
distance: true,
subtract: true,
angle: true,
},
}),
commonjs(),
resolve(),
esbuild({
include: /\.[jt]s$/,
tsconfig: 'tsconfig.json',
}),
prod && terser(),
html({
template: 'src/index.html',
target: 'dist/index.html',
inline: true,
}),
!prod && serve('dist'),
!prod && livereload('dist'),
],
}