-
Notifications
You must be signed in to change notification settings - Fork 350
/
rollup.config.mjs
62 lines (59 loc) · 1.54 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import resolve from '@rollup/plugin-node-resolve'; // 使用node_modules包
import terser from '@rollup/plugin-terser'; // 代码压缩
import babel from '@rollup/plugin-babel'; // ECMAScript兼容
import pkg from './package.json' with { type:'json' }; // 获取package信息
// 版权信息
const repository = pkg.repository.url.replace(/(.+)(:\/\/.+)\.git$/,'https$2');
const now = new Date();
const date = (new Date(now.getTime()-now.getTimezoneOffset()*60000)).toISOString().substr(0,10);
const banner = `/*!
* ${pkg.name} v${pkg.version}
* ${pkg.description}
* ${pkg.homepage}
*
* Copyright (c) 2016-present, ${pkg.author}
*
* Released under the ${pkg.license} License
* ${repository}
*
* Created on: ${date}
*/`;
const commonPlugins = [
resolve(),
terser(),
babel({
babelHelpers: 'runtime',
exclude:'node_modules/**'
})
];
export default [{
input: './src/relationship.js',
output:[{
file: pkg.main,
format: 'umd',
name: 'relationship',
banner
},{
file: pkg.module,
format: 'es',
banner
}],
plugins: commonPlugins,
watch: {
exclude: 'node_modules/**'
}
},{
input: './src/relationship-mode.js',
output:[{
file: './dist/relationship-mode.min.js',
format: 'umd',
name: 'relationshipMode'
},{
file: './dist/relationship-mode.min.mjs',
format: 'es'
}],
plugins: commonPlugins,
watch: {
exclude: 'node_modules/**'
}
}];