File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed
Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1414 ],
1515 "scripts" : {
1616 "build" : " npm run -s build:babel && npm run -s build:self && npm run build:types" ,
17- "build:babel" : " babel-node --extensions \" .ts\" src/cli.ts \" src/{cli,index}.ts\" --target=8 --output=dist" ,
18- "build:self" : " node dist/cli.js \" src/{cli,index}.ts\" --target=8 --output=dist" ,
17+ "build:babel" : " babel-node --extensions \" .ts\" src/cli.ts \" src/{cli,index}.ts\" --target=8 --output=dist --compress " ,
18+ "build:self" : " node dist/cli.js \" src/{cli,index}.ts\" --target=8 --output=dist --compress " ,
1919 "build:types" : " tsc --emitDeclarationOnly --outdir types --declaration --allowSyntheticDefaultImports src/{cli,index}.ts" ,
2020 "test" : " echo \" Error: no test specified\" && exit 1"
2121 },
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const mriConfig = {
1010 boolean : [ 'compress' ] ,
1111 default : {
1212 compress : false ,
13- output : 'lib ' ,
13+ output : 'dist ' ,
1414 } ,
1515} ;
1616
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ async function createRollupConfig({
4444
4545 let banner = '' ;
4646
47+ const externalTest = new RegExp ( `^(${ external . join ( '|' ) } )($|/)` ) ;
48+
4749 const inputOptions : InputOptions = {
4850 input,
4951 external : id => {
@@ -52,7 +54,8 @@ async function createRollupConfig({
5254 return true ;
5355 }
5456
55- return external . includes ( id ) ;
57+ // otherwise do what you'd normally expect for exclusion
58+ return externalTest . test ( id ) ;
5659 } ,
5760 plugins : [
5861 {
@@ -134,18 +137,20 @@ export async function bundler({
134137
135138 const pkg = await getConfig ( cwd ) ;
136139
137- const externalDependencies = Object . keys ( pkg . dependencies || { } ) ;
140+ const pkgDependencies = Object . keys ( pkg . dependencies || { } ) ;
138141
139142 const inputs = await glob ( input , { absolute : true } ) ;
140143
141144 for ( let idx = 0 ; idx < inputs . length ; idx ++ ) {
142145 const input = inputs [ idx ] ;
143146
147+ const externalDependencies = pkgDependencies . concat (
148+ inputs . filter ( e => e !== input )
149+ ) ;
150+
144151 const { inputOptions, outputOptions } = await createRollupConfig ( {
145152 compress,
146- externalDependencies : externalDependencies . concat (
147- inputs . filter ( e => e !== input )
148- ) ,
153+ externalDependencies,
149154 input,
150155 nodeTarget,
151156 outputDir,
You can’t perform that action at this time.
0 commit comments