-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup.config.js
71 lines (70 loc) · 2.01 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
62
63
64
65
66
67
68
69
70
71
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import json from '@rollup/plugin-json';
import babel from '@rollup/plugin-babel';
import serve from 'rollup-plugin-serve';
import livereload from 'rollup-plugin-livereload';
import jison from 'rollup-plugin-jison';
import copy from 'rollup-plugin-copy';
import clear from 'rollup-plugin-clear';
import execute from 'rollup-plugin-execute';
const isDev = process.env.BUILD === 'dev';
export default {
input: 'src/js/app.js',
output: {
file: 'dist/bundle.js',
format: 'iife',
sourcemap: isDev,
globals: {
angular: 'angular'
},
},
watch: {
exclude: 'docs/**',
},
plugins: [
!isDev ? clear({
targets: ['dist'],
}) : undefined,
copy({
targets: [
{src: 'src/app.html', dest: 'dist', rename: 'index.html'},
{src: 'src/img', dest: 'dist'},
{src: 'node_modules/roboto-fontface/fonts/roboto', dest: 'dist/fonts'},
{src: 'node_modules/dejavu-fonts-ttf/ttf/DejaVuSans.ttf', dest: 'dist/fonts/dejavu-sans'},
{src: 'node_modules/material-design-icons/iconfont/MaterialIcons-Regular.*', dest: 'dist/fonts/material-icons'},
],
}),
execute(
`node-sass ${isDev ? '--source-map true' : '--output-style compressed'} src/stylesheets/main.sass dist/bundle.css`
),
jison(),
json({
include: 'package.json'
}),
babel({
babelHelpers: 'bundled',
exclude: ['node_modules/**'],
}),
resolve({
browser: true,
preferBuiltins: false,
}),
commonjs({
include: ['node_modules/**']
}),
!isDev ?
terser({
output: {
comments: function(node, comment) {
if (comment.type === "comment2") {
return /@preserve|@license|@cc_on/i.test(comment.value);
}
}
}
}) : undefined,
isDev ? serve('dist') : undefined,
isDev ? livereload('dist') : undefined,
]
};