forked from justin-schroeder/arrow-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
44 lines (38 loc) · 935 Bytes
/
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
import { defineConfig, InputOptions, OutputOptions } from 'rollup'
import typescript from '@rollup/plugin-typescript'
import dts from 'rollup-plugin-dts'
const plugins: InputOptions['plugins'] = []
const output: OutputOptions = {
file: 'dist/index.mjs',
}
let input = 'src/index.ts'
if (process.env.BUILD === 'types') {
plugins.push(dts())
output.file = 'dist/index.d.ts'
input = 'dist/index.d.ts'
} else if (process.env.BUILD === 'iife') {
output.sourcemap = true
output.name = '$arrow'
output.format = 'iife'
output.file = 'dist/index.js'
plugins.push(
typescript({
sourceMap: false,
exclude: ['rollup.config.ts', 'src/__tests__/**'],
})
)
} else {
output.sourcemap = true
plugins.push(
typescript({
sourceMap: false,
exclude: ['rollup.config.ts', 'src/__tests__/**'],
})
)
}
const config = defineConfig({
input,
output,
plugins,
})
export default config