-
Notifications
You must be signed in to change notification settings - Fork 168
/
rollup.config.js
35 lines (33 loc) · 935 Bytes
/
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
import { defineConfig } from 'rollup'
import json from '@rollup/plugin-json'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import esbuild from 'rollup-plugin-esbuild'
import { builtinModules } from 'node:module'
import { readFileSync } from 'node:fs'
import { visualizer } from 'rollup-plugin-visualizer'
const pkg = JSON.parse(
readFileSync(new URL('./package.json', import.meta.url), 'utf8')
)
export default defineConfig({
input: {
index: 'src/index.ts',
zip: 'src/zip.ts'
},
output: {
dir: 'dist',
entryFileNames: '[name].js',
format: 'es'
},
external: [...Object.keys(pkg.dependencies), ...builtinModules, /node:/],
plugins: [
json(),
esbuild({
platform: 'node',
minify: true
}),
nodeResolve(),
commonjs(),
visualizer()
]
})