-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
85 lines (79 loc) · 2.67 KB
/
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
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 { generateDTS } from '@typhonjs-build-test/esm-d-ts';
import {
importsExternal,
importsResolve } from '@typhonjs-build-test/rollup-plugin-pkg-imports';
// Produce sourcemaps or not.
const sourcemap = true;
// Bundle all top level external package exports.
const dtsEventbusOptions = { bundlePackageExports: true };
export default () =>
{
return [
{ // This bundle is for the main eventbus subpath export
input: './src/eventbus/index.js',
output: [{
file: `./dist/eventbus/index.js`,
format: 'es',
generatedCode: { constBindings: true },
sourcemap
}],
plugins: [
importsExternal(),
resolve(),
generateDTS.plugin(dtsEventbusOptions)
]
},
{ // This bundle is for the pre-defined eventbus buses subpath export
input: './src/eventbus/buses/index.js',
output: [{
file: `./dist/eventbus/buses/index.js`,
format: 'es',
generatedCode: { constBindings: true },
sourcemap
}],
plugins: [
importsExternal(),
resolve(),
generateDTS.plugin(dtsEventbusOptions)
]
},
{ // This bundle is for the plugin manager Node distribution.
input: './src/manager/index.js',
output: [{
file: `./dist/manager/node/index.js`,
format: 'es',
generatedCode: { constBindings: true },
sourcemap
}],
plugins: [
importsExternal({ importKeys: ['#runtime/plugin/manager/*'] }),
importsResolve({
exportConditions: ['node', 'import'],
importKeys: ['#runtime/util/loader-module', '#runtime/util/object'] }
),
resolve({ exportConditions: ['node', 'import'] }),
generateDTS.plugin()
]
},
// This bundle is for the plugin manager browser distribution.
{
input: './src/manager/index.js',
output: [{
file: `./dist/manager/browser/index.js`,
format: 'es',
generatedCode: { constBindings: true },
sourcemap
}],
plugins: [
importsExternal({ importKeys: ['#runtime/plugin/manager/*'] }),
importsResolve({
exportConditions: ['browser', 'import'],
importKeys: ['#runtime/util/loader-module', '#runtime/util/object']
}),
resolve({ exportConditions: ['browser', 'import'] }),
generateDTS.plugin()
]
}
];
};