-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
116 lines (104 loc) · 2.28 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import Path from 'path';
import NodeResolve from 'rollup-plugin-node-resolve';
import CommonJs from 'rollup-plugin-commonjs';
const srcPath = Path.join('.', 'src', 'src');
const inSrc = (relPath) => Path.join(srcPath, relPath);
const plugins = [
NodeResolve({
browser: true,
}),
CommonJs({
include: [
'./src/node_modules/**',
],
}),
];
const absAndRel = (filePath) => [
// './utils'
`.${Path.sep}${filePath}`, // `Path.join` won't work here.
// Absolute. Required.
Path.resolve(
inSrc(filePath),
),
];
const external = [
...absAndRel('utils'),
'../utils',
'debug',
];
const externalAll = [
...external,
...absAndRel('error-catchers'),
...absAndRel('get-notifiers-singleton'),
];
const utilsFullPath = Path.resolve(inSrc('utils'));
const globals = {
[utilsFullPath]: 'Weer.Utils',
};
export default [
{
plugins,
input: inSrc('utils.js'),
output: [
{ file: './dist/cjs/utils.js', format: 'cjs' },
{ file: './dist/esm/utils.js', format: 'es' },
{
file: './dist/umd/utils.js',
format: 'umd',
name: 'Weer.Utils',
globals,
},
],
},
{
plugins,
external,
input: inSrc('error-catchers.js'),
output: [
{ file: './dist/cjs/error-catchers.js', format: 'cjs' },
{ file: './dist/esm/error-catchers.js', format: 'es' },
{
file: './dist/umd/error-catchers.js',
format: 'umd',
name: 'Weer.ErrorCatchers',
globals,
},
],
},
{
plugins,
external,
input: inSrc('get-notifiers-singleton.js'),
output: [
{ file: './dist/cjs/get-notifiers-singleton.js', format: 'cjs' },
{ file: './dist/esm/get-notifiers-singleton.js', format: 'es' },
{
file: './dist/umd/get-notifiers-singleton.js',
format: 'umd',
name: 'Weer.GetNotifiersSingleton',
globals,
},
],
},
{
plugins,
external: externalAll,
input: inSrc('index.js'),
output: [
{ file: './dist/cjs/index.js', format: 'cjs' },
{ file: './dist/esm/index.js', format: 'es' },
],
},
{
plugins,
input: inSrc('index.js'),
output: [
{
file: './dist/umd/index.js',
format: 'umd',
name: 'Weer',
globals,
},
],
},
];