-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.ts
52 lines (46 loc) · 1.12 KB
/
rollup.config.ts
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
import type { RollupOptions } from 'rollup'
import { defineConfig } from 'rollup'
import esbuild from 'rollup-plugin-esbuild'
import json from '@rollup/plugin-json'
import alias from '@rollup/plugin-alias'
import dts from 'rollup-plugin-dts'
const external: RollupOptions['external'] = ['shared/types/types.d.ts']
const plugins: RollupOptions['plugins'] = [alias({
entries: {
'@shared/*': 'src/shared/*',
},
}), esbuild(), json()]
const node: RollupOptions = {
plugins,
external,
input: ['src/node/index.ts', 'src/node/cli.ts'],
output: {
format: 'esm',
entryFileNames: '[name].js',
chunkFileNames: 'serve-[hash].js',
dir: 'dist/node',
},
}
const nodeTypes: RollupOptions = {
input: 'src/node/index.ts',
output: {
format: 'esm',
file: 'dist/node/index.d.ts',
},
external,
plugins: [dts({ respectExternal: true })],
}
const clientTypes: RollupOptions = {
input: 'src/client/index.ts',
output: {
format: 'esm',
file: 'dist/client/index.d.ts',
},
external,
plugins: [dts({ respectExternal: true })],
}
export default defineConfig([
node,
nodeTypes,
clientTypes,
])