-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
47 lines (41 loc) · 1.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
import path from 'path';
import resolve from '@rollup/plugin-node-resolve'; // This resolves NPM modules from node_modules.
import { generateDTS } from '@typhonjs-build-test/esm-d-ts';
await generateDTS({
input: './src/node/index.js',
output: './types/index.d.ts',
});
// The deploy path for the distribution for browser & Node.
const s_DIST_PATH_BROWSER = './dist/browser';
const s_DIST_PATH_NODE = './dist/node';
// Produce sourcemaps or not.
const s_SOURCEMAP = true;
export default () =>
{
return [{ // This bundle is for the Node distribution.
input: ['src/node/index.js'],
output: [{
file: `${s_DIST_PATH_NODE}${path.sep}ModuleLoader.js`,
format: 'es',
generatedCode: { constBindings: true },
sourcemap: s_SOURCEMAP,
}],
plugins: [
resolve()
]
},
// This bundle is for the browser distribution.
{
input: ['src/browser/index.js'],
output: [{
file: `${s_DIST_PATH_BROWSER}${path.sep}ModuleLoader.js`,
format: 'es',
generatedCode: { constBindings: true },
sourcemap: s_SOURCEMAP,
}],
plugins: [
resolve({ browser: true })
]
}
];
};