-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
42 lines (37 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
import resolve from '@rollup/plugin-node-resolve';
import ttypescript from 'ttypescript';
import tsPlugin from 'rollup-plugin-typescript2';
import cleaner from 'rollup-plugin-cleaner';
import commonjs from '@rollup/plugin-commonjs';
import serve from 'rollup-plugin-serve';
import { string } from 'rollup-plugin-string';
import { terser } from 'rollup-plugin-terser';
const isProd = process.env.NODE_ENV === 'production';
const commonPlugins = [
resolve(),
commonjs(),
tsPlugin({ typescript: ttypescript }),
cleaner({ targets: ['dist'] }),
string({ include: '**/*.wgsl' })
];
const devPlugins = () => [
...commonPlugins,
serve({
host: 'localhost',
port: 4399,
contentBase: ['docs', './']
})
];
const prodPlugins = () => [...commonPlugins, terser()];
export default [
{
input: './src/index.ts',
output: {
dir: 'dist',
format: 'umd',
name: 'Athena',
sourcemap: true
},
plugins: isProd ? prodPlugins() : devPlugins()
}
];