forked from VolodymyrBaydalka/docxjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
54 lines (50 loc) · 971 Bytes
/
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
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import nodeExternals from 'rollup-plugin-node-externals';
const umdOutput = {
name: "docx",
file: 'docs/js/docx-preview.js',
sourcemap: true,
format: 'umd',
globals: {
jszip: 'JSZip',
konva: 'Konva',
"lodash-es": '_',
}
};
export default args => {
const config = {
input: 'src/docx-preview.ts',
output: [umdOutput],
plugins: [
nodeExternals(),
typescript(),
],
}
if (args.environment === 'BUILD:production') {
// 输出配置
config.output = [umdOutput,
{
...umdOutput,
file: 'dist/docx-preview.js',
},
{
...umdOutput,
file: 'dist/docx-preview.min.js',
plugins: [terser()]
},
{
file: 'dist/docx-preview.esm.js',
sourcemap: true,
format: 'es',
},
{
file: 'dist/docx-preview.esm.min.js',
sourcemap: true,
format: 'es',
plugins: [terser()]
},
];
}
return config
};