File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ;
You can’t perform that action at this time.
0 commit comments