forked from nonzzz/vite-bundle-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mts
33 lines (31 loc) · 876 Bytes
/
rollup.config.mts
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
import { builtinModules } from 'module'
import { defineConfig } from 'rollup'
import dts from 'rollup-plugin-dts'
import { minify, swc } from 'rollup-plugin-swc3'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import shim from '@rollup/plugin-esm-shim'
import commonjs from '@rollup/plugin-commonjs'
const external = [...builtinModules]
export default defineConfig([
{
input: 'src/server/index.ts',
external,
output: [
{ file: 'dist/index.mjs', format: 'esm', exports: 'named' },
{ file: 'dist/index.js', format: 'cjs', exports: 'named' }
],
plugins: [
commonjs(),
nodeResolve(),
shim(),
swc(),
minify({ mangle: true, module: true, compress: true, sourceMap: true })
]
},
{
input: 'src/server/index.ts',
output: { file: 'dist/index.d.ts' },
plugins: [dts()],
external
}
])