-
Notifications
You must be signed in to change notification settings - Fork 9
/
rollup.config.js
74 lines (63 loc) · 1.68 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
72
73
74
import typescript from 'rollup-plugin-typescript2';
import vue from 'rollup-plugin-vue';
import clear from 'rollup-plugin-clear';
import externals from 'rollup-plugin-node-externals';
import { terser } from 'rollup-plugin-terser';
import banner2 from 'rollup-plugin-banner2';
import styles from 'rollup-plugin-styles';
const pjson = require('./package.json');
const isProduction = (process.env.NODE_ENV === 'production');
console.log(`${ isProduction ? 'production' : 'development' } mode bundle`);
export default async function config(args) {
return {
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'cjs',
sourcemap: true,
exports: 'named',
assetFileNames: '[name][extname]',
},
plugins: [
vue(),
styles({
minimize: true,
mode: ['extract', 'main.css'],
}),
typescript({
tsconfigOverride: {
compilerOptions: {
declaration: true,
},
include: null,
},
}),
clear({
targets: ['./dist'],
}),
externals({
deps: false, // If you installed your own deps with --save
devDeps: false // If you installed your own deps with --save-dev
}),
terser({
ecma: 2020,
mangle: { toplevel: true },
compress: {
module: true,
toplevel: true,
unsafe_arrows: true,
drop_console: isProduction,
drop_debugger: isProduction,
},
output: { quote_style: 1 },
}),
banner2(() => `/**
* ${pjson.name} v${pjson.version} by ${pjson.author}
* Homepage: ${pjson.homepage}
*/
`, {
sourcemap: true,
}),
],
};
};