forked from small-tech/vite-plugin-sri
/
rollup.config.ts
39 lines (34 loc) · 924 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
import { readFileSync } from 'fs'
import { defineConfig } from 'rollup'
import ts from '@rollup/plugin-typescript';
export default defineConfig({
input: 'index.ts',
output: [
{
file: 'lib/index.cjs',
format: 'cjs',
exports: 'default',
preferConst: true,
// https://nodejs.org/api/esm.html#esm_commonjs_namespaces
interop: 'default',
// Extract license header
// @ts-ignore
banner: () => readFileSync('index.ts', 'utf8').match(/^\/{4,}[^]+?\/{4,}/)[0],
},
{
file: 'lib/index.js',
format: 'esm',
exports: 'default',
preferConst: true,
// https://nodejs.org/api/esm.html#esm_commonjs_namespaces
interop: 'default',
// Extract license header
// @ts-ignore
banner: () => readFileSync('index.ts', 'utf8').match(/^\/{4,}[^]+?\/{4,}/)[0],
}
],
external: () => true,
plugins: [
ts()
]
})