-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
50 lines (45 loc) · 1.05 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
import commonjs from '@rollup/plugin-commonjs'
import filesize from 'rollup-plugin-filesize'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload'
import { terser } from 'rollup-plugin-terser'
const path = require('path')
var devPlugins = []
var prodPlugins = []
var mode = process.env.NODE_ENV || 'dev'
if (mode === 'dev') {
devPlugins = [
serve(),
livereload('dist')
]
} else if (mode === 'prod') {
prodPlugins = [ terser() ]
}
export default {
input: './app/index.js',
output: [
{
file: path.resolve(__dirname, './dist/bundled.js'),
format: 'es',
name: 'Realworld',
sourcemap: true,
plugins: devPlugins
},
{
file: path.resolve(__dirname, './dist/bundled.min.js'),
format: 'es',
name: 'Realworld',
plugins: prodPlugins
}
],
plugins: [
commonjs(),
nodeResolve(),
filesize({
showGzippedSize: true,
showBrotliSize: false,
showMinifiedSize: false
})
]
}