-
Notifications
You must be signed in to change notification settings - Fork 13
/
rollup.config.js
52 lines (49 loc) · 991 Bytes
/
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
const buble = require('@rollup/plugin-buble');
const typescript = require('@rollup/plugin-typescript');
const isDist = process.env.BUILD_TYPE === 'dist';
const plugins = [
typescript({
compilerOptions: isDist
? {}
: {
module: 'esnext',
declaration: true,
outDir: 'es',
},
}),
buble({ objectAssign: true }),
];
module.exports = isDist
? {
input: './src/index.ts',
output: [
{
file: './dist/b-validate.es.js',
format: 'es',
},
{
file: './dist/b-validate.cjs.js',
format: 'cjs',
},
],
plugins,
}
: [
{
input: './src/index.ts',
},
{
input: './src/locale/zh-CN.ts',
},
].map((x) => ({
...x,
output: [
{
dir: 'es/',
format: 'esm',
preserveModules: true,
preserveModulesRoot: 'src',
},
],
plugins,
}));