-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrollup.config.js
56 lines (51 loc) · 1.22 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
import resolve from 'rollup-plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import { eslint } from 'rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import glslify from 'rollup-plugin-glslify'
const extensions = ['.js', '.ts']
const commonPlugins = () => [
resolve({ extensions }),
eslint({
include: 'src/*'
}),
babel({ extensions, include: ['src/**/*'] }),
glslify({
basedir: 'src/shaders',
exclude: 'node_modules/**'
})
]
const makeOutput = (name, format) => ({
file: name,
format: format,
name: 'SixDOF',
exports: 'named',
sourcemap: true,
globals: { three: 'THREE' }
})
const config = [
{
input: 'src/index.ts',
output: [
makeOutput(`dist/three-6dof.js`, 'umd'),
makeOutput(`dist/three-6dof.amd.js`, 'amd'),
makeOutput(`dist/three-6dof.esm.js`, 'esm')
],
external: ['three'],
plugins: commonPlugins()
},
{
input: 'src/index.ts',
output: [
makeOutput(`dist/three-6dof.min.js`, 'umd'),
makeOutput(`dist/three-6dof.amd.min.js`, 'amd'),
makeOutput(`dist/three-6dof.esm.min.js`, 'esm')
],
external: ['three'],
plugins: [
...commonPlugins(),
terser()
]
}
]
module.exports = config