-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
48 lines (45 loc) · 1.17 KB
/
rollup.config.mjs
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
import { fileURLToPath } from 'node:url'
import { resolve } from 'node:path'
import { isBuiltin } from 'node:module'
import { defineConfig } from 'rollup'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import { dts } from 'rollup-plugin-dts'
const __dirname = fileURLToPath(new URL('.', import.meta.url))
export default defineConfig([
{
input: {
index: resolve(__dirname, './src/index.ts'),
cli: resolve(__dirname, './src/cli.ts'),
constant: resolve(__dirname, './src/constants.ts')
},
output: {
dir: './dist',
format: 'esm'
},
external (id) {
return isBuiltin(id) || ['minidev', 'tt-ide-cli'].includes(id)
},
plugins: [
nodeResolve({
extensions: ['.ts', '.js'],
preferBuiltins: false
}),
commonjs(),
typescript({
exclude: ['node_modules/**']
}),
json()
]
},
{
input: resolve(__dirname, 'src/index.ts'),
output: {
file: 'dist/index.d.ts',
format: 'esm'
},
plugins: [dts()]
}
])