1 | import resolve from 'rollup-plugin-node-resolve'
|
2 | import commonjs from 'rollup-plugin-commonjs'
|
3 | import json from 'rollup-plugin-json'
|
4 | import babel from 'rollup-plugin-babel'
|
5 | import babili from 'rollup-plugin-babili'
|
6 | import fs from 'fs-extra'
|
7 |
|
8 |
|
9 | if (fs.existsSync('dist')) fs.emptyDirSync('dist')
|
10 |
|
11 | if (!fs.existsSync('dist')) fs.mkdirSync('dist')
|
12 |
|
13 | fs.copySync('./site/index.html', './dist/index.html')
|
14 |
|
15 | let plugs = [
|
16 | resolve({
|
17 | main: true,
|
18 | jsnext: true,
|
19 | preferBuiltins: true
|
20 | }),
|
21 | commonjs(),
|
22 | json(),
|
23 | babel({
|
24 | exclude: 'node_modules/**'
|
25 | })
|
26 | ]
|
27 |
|
28 | if (process.env.NODE_ENV === 'production') {
|
29 | plugs.push(
|
30 | babili({
|
31 | comments: false
|
32 | })
|
33 | )
|
34 | }
|
35 |
|
36 | export default {
|
37 | entry: './site/main.js',
|
38 | dest: './dist/bundle.js',
|
39 | format: 'es',
|
40 | plugins: plugs
|
41 | }
|