-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
85 lines (81 loc) · 2.24 KB
/
rollup.config.mjs
File metadata and controls
85 lines (81 loc) · 2.24 KB
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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
const external = ['@brickhouse-tech/angular-lts'];
const globals = { '@brickhouse-tech/angular-lts': 'angular' };
function makeConfig(input, outputBase, extraExternal = []) {
const allExternal = [...external, ...extraExternal];
const allGlobals = { ...globals };
extraExternal.forEach((e) => (allGlobals[e] = e));
return [
{
input,
external: allExternal,
output: [
{
file: `dist/${outputBase}.js`,
format: 'umd',
name: 'nemLogging',
globals: allGlobals,
exports: 'named',
},
{
file: `dist/${outputBase}.esm.js`,
format: 'es',
globals: allGlobals,
exports: 'named',
},
],
plugins: [resolve(), commonjs()],
},
{
input,
external: allExternal,
output: {
file: `dist/${outputBase}.min.js`,
format: 'umd',
name: 'nemLogging',
globals: allGlobals,
exports: 'named',
},
plugins: [resolve(), commonjs(), terser()],
},
];
}
export default [
...makeConfig('src/index.js', 'angular-simple-logger', ['debug']),
...makeConfig('src/index.light.js', 'angular-simple-logger.light'),
// Browser-safe UMD bundle with debug inlined (for bower/script-tag users)
// Uses debug's browser build via conditional exports
{
input: 'src/index.js',
external: ['@brickhouse-tech/angular-lts'],
output: {
file: 'dist/angular-simple-logger.bundle.js',
format: 'umd',
name: 'nemLogging',
globals: { '@brickhouse-tech/angular-lts': 'angular' },
exports: 'named',
},
plugins: [
resolve({ browser: true, preferBuiltins: false }),
commonjs(),
],
},
{
input: 'src/index.js',
external: ['@brickhouse-tech/angular-lts'],
output: {
file: 'dist/angular-simple-logger.bundle.min.js',
format: 'umd',
name: 'nemLogging',
globals: { '@brickhouse-tech/angular-lts': 'angular' },
exports: 'named',
},
plugins: [
resolve({ browser: true, preferBuiltins: false }),
commonjs(),
terser(),
],
},
];