-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.mjs
43 lines (40 loc) · 1.08 KB
/
rollup.config.mjs
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
import postcss from 'rollup-plugin-postcss';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import postcssComments from 'postcss-discard-comments';
import autoprefixer from 'autoprefixer';
import copy from 'rollup-plugin-copy';
const production = !process.env.ROLLUP_WATCH;
const postcssPlugins = [
autoprefixer(),
postcssComments({'removeAll': true})
];
export default {
input: 'assets/index.ts',
output: {
file: 'resources/core.js',
name: 'main.js',
format: 'iife',
sourcemap: !production
},
plugins: [
resolve(),
typescript({'sourceMap': !production}),
commonjs(),
postcss({
extract: true,
minimize: production,
sourceMap: !production,
plugins: postcssPlugins
}),
copy({
targets: [
{src: 'assets/img/*', dest: 'resources/img'},
{src: 'assets/font/*', dest: 'resources/font'}
]
}),
production && terser({format: {comments: false}})
]
};