-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
70 lines (67 loc) · 1.46 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
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import terser from '@rollup/plugin-terser';
const pkg = require('./package.json');
const banner = `/*!
* Name: ${pkg.name}
* Description: ${pkg.description}
* Author: ${pkg.author}
* Contributors: ${pkg.contributors.map(c => c.name).join(',')}
* Version: v${pkg.version}
*/
`;
const globals = {
'@galacean/effects': 'ge',
};
const external = ['@galacean/effects'];
const plugins = [
typescript({ tsconfig: './tsconfig.bundle.json' }),
resolve(),
commonjs(),
];
export default (commandLineArgs) => {
return [{
input: {
index: 'components/index.ts',
swiper: 'components/swiper/index.ts',
animation: 'components/animation/index.ts',
},
output: {
dir: 'es',
chunkFileNames: 'chunk-[name].mjs',
entryFileNames: '[name]/index.mjs',
format: 'es',
banner,
globals,
},
treeshake: true,
external,
plugins,
}, {
input: 'components/index.ts',
output: {
file: pkg.main,
format: 'cjs',
banner,
globals,
sourcemap: true,
},
external,
plugins,
}, {
input: 'components/index.ts',
output: {
file: pkg.brower,
format: 'umd',
name: 'ge.components',
banner,
globals,
sourcemap: true,
},
external,
plugins: plugins.concat(
terser()
),
}];
};