-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.ts
61 lines (58 loc) · 1.67 KB
/
rollup.config.ts
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
import { RollupOptions } from 'rollup';
// rollup plugins
import * as del from 'rollup-plugin-delete';
import * as typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import { addPackageFiles, cleanComments } from './rollup.plugin';
// rebuild config array to switch plugins values from config by plugins functions
const config: RollupOptions[] = [
{
input: './src/index.ts',
output: {
dir: './dist',
format: 'esm',
entryFileNames: 'bundle/rx-file-upload.js',
preferConst: true,
},
plugins: [
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
del({ targets: ['./dist'] }),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
typescript(),
nodeResolve(),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
addPackageFiles(['README.md', 'package.json']),
],
external: [
'rxjs',
'rxjs/ajax',
'rxjs/operators',
'crypto-es/lib/sha256',
'crypto-es/lib/core',
],
},
{
input: './src/index.ts',
output: {
dir: './dist',
format: 'umd',
name: 'RxFileUploadUnPkg',
entryFileNames: 'bundle/rx-file-upload.umd.min.js',
},
plugins: [
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
typescript({ tsconfig: './tsconfig.es5.json' }),
nodeResolve(),
terser(),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
cleanComments(),
],
},
];
export default config;