Skip to content

Commit f65d2a9

Browse files
committed
fix: add missing rollup config
1 parent 9a23972 commit f65d2a9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

rollup.config.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import typescript from '@rollup/plugin-typescript';
2+
import { nodeResolve } from '@rollup/plugin-node-resolve';
3+
import { readFileSync } from 'fs';
4+
5+
const dependencies = Object.keys(
6+
JSON.parse(readFileSync('./package.json')).dependencies
7+
);
8+
9+
const createOutput = (extra) => ({
10+
dir: 'dist',
11+
sourcemap: true,
12+
entryFileNames: () => `[name].${extra?.format === 'es' ? 'mjs' : 'js'}`,
13+
chunkFileNames: info => `chunk.[hash].${extra?.format === 'es' ? 'mjs' : 'js'}`,
14+
...extra,
15+
})
16+
17+
export default {
18+
input: {
19+
bin: 'src/bin.ts',
20+
index: 'src/index.ts'
21+
},
22+
external: [
23+
...dependencies,
24+
],
25+
output: [
26+
createOutput({ format: 'es' }),
27+
createOutput({ format: 'cjs' }),
28+
],
29+
plugins: [
30+
typescript({ tsconfig: './tsconfig.json', declarationMap: false }),
31+
nodeResolve(),
32+
]
33+
};

0 commit comments

Comments
 (0)