-
Notifications
You must be signed in to change notification settings - Fork 77
/
rollup.config.js
83 lines (80 loc) · 1.94 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
75
76
77
78
79
80
81
82
83
import typescript from 'rollup-plugin-typescript2';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import pkg from './package.json';
const plugins = [
typescript(),
resolve(),
commonjs(),
];
const sourcemap = true;
const freeze = false;
const input = 'src/index.ts';
const bundleInput = 'src/bundle.ts';
const external = Object.keys(pkg.dependencies);
const compiled = (new Date()).toUTCString().replace(/GMT/g, "UTC");
const banner = `/*!
* ${pkg.name} - v${pkg.version}
* ${pkg.homepage}
* Compiled ${compiled}
*
* ${pkg.name} is licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license
*/`;
export default [
{
input,
plugins,
external,
output: [
{
banner,
file: 'dist/resource-loader.cjs.js',
format: 'cjs',
freeze,
sourcemap,
},
{
banner,
file: 'dist/resource-loader.esm.js',
format: 'esm',
freeze,
sourcemap,
}
]
},
{
input: bundleInput,
plugins,
output: {
banner,
name: 'Loader',
file: 'dist/resource-loader.js',
format: 'iife',
freeze,
sourcemap,
}
},
{
input: bundleInput,
plugins: [].concat(plugins, terser({
output: {
comments(node, comment) {
return comment.line === 1;
},
},
compress: {
drop_console: true,
},
})),
output: {
banner,
name: 'Loader',
file: 'dist/resource-loader.min.js',
format: 'iife',
freeze,
sourcemap,
}
}
];