-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
63 lines (60 loc) · 1.45 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
import path from 'path';
import { terser } from 'rollup-plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from 'rollup-plugin-typescript2';
import pkg from './package.json';
const getPath = (_path) => path.resolve(__dirname, _path);
const extensions = ['.js', '.jsx', '.ts', '.tsx'];
/** @type {import('rollup').RollupOptions} */
const options = {
input: getPath('src/index.ts'),
output: [
{
file: getPath(pkg.main),
name: 'xcall',
format: 'cjs',
plugins: [terser()]
},
{
file: getPath(pkg.module),
name: 'xcall',
format: 'es',
plugins: [terser()]
},
{
file: getPath(pkg.unpkg),
name: 'xcall',
format: 'umd',
plugins: [terser()]
},
{
file: getPath(pkg.iife),
name: '$call',
format: 'umd',
plugins: [terser()]
},
{
file: getPath(pkg['main-source']),
name: 'xcall',
format: 'cjs' // lib
},
{
file: getPath(pkg['module-source']),
name: 'xcall',
format: 'es' // es
},
{
file: getPath(pkg['unpkg-source']),
name: 'xcall',
format: 'umd' // dist
},
{
file: getPath(pkg['iife-source']),
name: '$call',
format: 'umd' // iife
}
],
plugins: [resolve(extensions), commonjs(), typescript({ tsconfig: getPath('tsconfig.json'), extensions })]
};
export default options;