-
Notifications
You must be signed in to change notification settings - Fork 21
/
rollup.config.js
61 lines (54 loc) · 1.25 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
60
61
import typescript from '@rollup/plugin-typescript'
import eslint from '@rbnlffl/rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import postcss from 'rollup-plugin-postcss'
import nested from 'postcss-nested'
const { NODE_ENV } = process.env
const input = 'src/index.ts'
const name = 'ThreeStoryControls'
const sourcemap = true
const commonPlugins = () => {
const plugins = [
eslint(),
typescript(),
postcss({
extensions: ['.css'],
plugins: [nested()],
}),
]
if (NODE_ENV === 'production') {
plugins.push(terser())
}
return plugins
}
const umdConfig = {
input,
output: {
file: `dist/three-story-controls${NODE_ENV == 'production' ? '.min' : ''}.js`,
format: 'umd',
name,
sourcemap,
globals: {
three: 'THREE',
gsap: 'gsap',
},
},
external: ['three', 'gsap'],
plugins: [...commonPlugins()],
}
const esmConfig = {
input,
output: {
file: `dist/three-story-controls.esm${NODE_ENV == 'production' ? '.min' : ''}.js`,
format: 'es',
name,
sourcemap,
},
external: ['three', 'gsap'],
plugins: [...commonPlugins()],
}
const config = [umdConfig, esmConfig]
// if (NODE_ENV === 'production') {
// config.push(umdConfig)
// }
export default config