-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
58 lines (54 loc) · 1.36 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
import commonjs from 'rollup-plugin-commonjs'
import htmlBundle from 'rollup-plugin-html-bundle'
import livereload from 'rollup-plugin-livereload'
import nodeResolve from 'rollup-plugin-node-resolve'
import serve from 'rollup-plugin-serve'
import { terser } from 'rollup-plugin-terser'
import { makeLevels } from './rollup-plugin-make-levels/index'
const fs = require('fs')
const path = require('path')
const production = !process.env.ROLLUP_WATCH
export default {
external: [
'VirtualStick',
'zzfx'
],
input: 'src/main.js',
output: {
banner:
'if (!window.AudioContext && window.webkitAudioContext) {' +
' window.AudioContext = window.webkitAudioContext' +
'}' +
'exports={};' + fs.readFileSync(path.join(
__dirname,
'node_modules/virtual-stick/dist/bundle.js'
), 'utf-8') +
';' + fs.readFileSync(path.join(
__dirname,
'node_modules/zzfx/ZzFX.micro.js'
), 'utf-8'),
file: 'dist/bundle.js',
format: 'iife',
globals: {
VirtualStick: 'VirtualStick',
zzfx: 'zzfx'
}
},
plugins: [
makeLevels(),
nodeResolve(),
commonjs(),
production && terser(),
htmlBundle({
inline: true
}),
!production && serve('dist'),
!production && livereload()
],
watch: {
exclude: [
'node_modules/**',
'src/levels.js'
]
}
}