-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
49 lines (48 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
import babel from '@rollup/plugin-babel'
import { terser } from 'rollup-plugin-terser'
import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload'
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import typescript from '@rollup/plugin-typescript'
import alias from '@rollup/plugin-alias'
const path = require('path')
const resolveDir = dir => path.resolve(__dirname, dir)
const env = process.env.NODE_ENV
const config = {
input: 'src/main.ts',
output: {
format: 'umd',
file: 'dist/index.js',
name: 'Yeux',
sourcemap: env !== 'production'
},
plugins: [
typescript(),
resolve(),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**'
}),
livereload(),
serve({
open: true,
port: 8000,
openPage: '/playground/index.html',
contentBase: ''
}),
replace({
preventAssignment: false,
'process.env.NODE_ENV': JSON.stringify(env)
}),
commonjs(),
alias({
entries: [{ find: '@', replacement: resolveDir('src') }]
})
]
}
if (env === 'production') {
config.plugins.push(terser())
}
export default config