@@ -29,6 +29,19 @@ const extensions = ['.js', '.ts']
2929// But the polyfill doesn't export all required fields and make the build crash 
3030const  IGNORED_NODE_POLYFILLS  =  new  Set ( [ 'os' ,  'fs' ] ) 
3131
32+ function  isExternal  ( source : string )  { 
33+   if  ( IGNORED_NODE_POLYFILLS . has ( source ) )  { 
34+     return  true 
35+   } 
36+   if  ( source . startsWith ( 'extensions/' ) )  { 
37+     return  false 
38+   } 
39+   if  ( externals . some ( external  =>  source  ===  external  ||  source . startsWith ( `${ external }  /` ) ) )  { 
40+     return  true 
41+   } 
42+   return  false 
43+ } 
44+ 
3245export  default  rollup . defineConfig ( { 
3346  cache : false , 
3447  input : { 
@@ -38,21 +51,6 @@ export default rollup.defineConfig({
3851    annotations : true , 
3952    moduleSideEffects : false 
4053  } , 
41-   external : function  isExternal  ( source ,  importer ,  isResolved )  { 
42-     if  ( IGNORED_NODE_POLYFILLS . has ( source ) )  { 
43-       return  true 
44-     } 
45-     if  ( isResolved )  { 
46-       return  false 
47-     } 
48-     if  ( source . startsWith ( 'extensions/' ) )  { 
49-       return  false 
50-     } 
51-     if  ( externals . some ( external  =>  source  ===  external  ||  source . startsWith ( `${ external }  /` ) ) )  { 
52-       return  true 
53-     } 
54-     return  false 
55-   } , 
5654  output : [ { 
5755    chunkFileNames : '[name].js' , 
5856    hoistTransitiveImports : false , 
@@ -62,6 +60,24 @@ export default rollup.defineConfig({
6260    preserveModulesRoot : 'src' 
6361  } ] , 
6462  plugins : [ 
63+     { 
64+       name : 'external-resolver' , 
65+       resolveId  ( id )  { 
66+         if  ( id  ===  'vscode-languageclient/browser' )  { 
67+           return  { 
68+             id : 'vscode-languageclient/browser.js' , 
69+             external : 'absolute' 
70+           } 
71+         } 
72+         if  ( isExternal ( id ) )  { 
73+           return  { 
74+             id, 
75+             external : true 
76+           } 
77+         } 
78+         return  undefined 
79+       } 
80+     } , 
6581    typescript ( { 
6682      noEmitOnError : true 
6783    } ) , 
0 commit comments