11import { build } from "esbuild" ;
22import { cleanPlugin } from "esbuild-clean-plugin" ;
3- import { esbuildPluginNodeExternals } from "esbuild-plugin-node-externals" ;
43import copyStaticFiles from "esbuild-copy-static-files" ;
54import glob from "glob" ;
65import { sep } from "path" ;
@@ -54,13 +53,26 @@ function noFolders(src) {
5453 return ! isDirectory ;
5554}
5655
56+ const bundleAsMuchAsWeCan = {
57+ name : 'my-special-bundle' ,
58+ setup ( build ) {
59+ build . onResolve ( { filter : / ^ [ ^ . \/ ] | ^ \. [ ^ . \/ ] | ^ \. \. [ ^ \/ ] / } , args => {
60+ console . log ( args . path ) ;
61+ console . log ( `args.resolveDir=${ args . resolveDir } ` ) ;
62+ if ( args . path . startsWith ( "azure-pipelines-tool-lib" ) || args . path . startsWith ( "azure-pipelines-task-lib" ) )
63+ return { path : args . path , external : true } ;
64+ } )
65+ } ,
66+ }
67+
5768build ( {
5869 entryPoints : entryPoints ( ) ,
5970 bundle : true ,
6071 target : "es2018" ,
6172 platform : "node" ,
6273 outdir : "dist" ,
6374 metafile : true ,
75+ minify : true ,
6476 plugins : [
6577 cleanPlugin ( ) ,
6678 copyStaticFiles ( { src : "./source/img" , dest : "dist/img" } ) ,
@@ -69,7 +81,7 @@ build({
6981 copyStaticFiles ( { src : "./node_modules/vss-web-extension-sdk/lib" , dest : "dist/widgets/ProjectStatus/lib" } ) ,
7082 copyStaticFiles ( { src : "./source/tasks" , dest : "dist/tasks" , filter : noTSFiles } ) ,
7183 copyStaticFiles ( { src : "./source/tasksLegacy" , dest : "dist/tasks" , filter : noTSFiles } ) ,
72- esbuildPluginNodeExternals ( ) ,
84+ bundleAsMuchAsWeCan
7385 ] ,
7486 logLimit : 0 ,
7587 logLevel : "info" ,
0 commit comments