-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.demos.js
48 lines (46 loc) · 1.4 KB
/
rollup.demos.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
/*
* This config only bundles the demos and serves as an example of how to bundle the lib with your code.
* The library itself is published unbundled.
*/
// @ts-check
import { defineConfig } from 'rollup'
import { nodeExternals } from 'rollup-plugin-node-externals'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import { libwin32 } from 'libwin32/rollup-plugin'
// Use distinct configs to prevent Rollup from code-splitting the library.
export default [
makeConfig('messagebox'),
makeConfig('enumdesktopwindows'),
makeConfig('window'),
]
/** @param { string } which */
function makeConfig(which) {
return defineConfig({
input: `source/demos/${which}.ts`,
output: {
file: `demos/${which}/${which}.js`,
format: 'esm',
generatedCode: {
preset: 'es2015',
symbols: false
},
freeze: false,
sourcemap: true
},
plugins: [
nodeExternals(),
nodeResolve(),
commonjs(),
typescript({
rootDir: `source/demos`,
outDir: `demos/${which}`,
target: 'ES2023',
declaration: false,
declarationMap: false
}),
libwin32()
]
})
}