File tree 1 file changed +10
-0
lines changed
dev-packages/native-webpack-plugin/src
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ const REQUIRE_VSCODE_WINDOWS_CA_CERTS = '@vscode/windows-ca-certs';
25
25
const REQUIRE_BINDINGS = 'bindings' ;
26
26
const REQUIRE_KEYMAPPING = './build/Release/keymapping' ;
27
27
const REQUIRE_PARCEL_WATCHER = './build/Release/watcher.node' ;
28
+ const REQUIRE_NODE_PTY_CONPTY = '../build/Release/conpty.node' ;
28
29
29
30
export interface NativeWebpackPluginOptions {
30
31
out : string ;
@@ -71,6 +72,11 @@ export class NativeWebpackPlugin {
71
72
[ REQUIRE_VSCODE_WINDOWS_CA_CERTS ] : windowsCaCertsFile ,
72
73
[ REQUIRE_PARCEL_WATCHER ] : issuer => Promise . resolve ( findNativeWatcherFile ( issuer ) )
73
74
} ;
75
+ if ( process . platform !== 'win32' ) {
76
+ // The expected conpty.node file is not available on non-windows platforms during build.
77
+ // We need to provide a stub that will be replaced by the real file at runtime.
78
+ replacements [ REQUIRE_NODE_PTY_CONPTY ] = ( ) => buildFile ( directory , 'conpty.js' , conhostWindowsReplacement ( ) ) ;
79
+ }
74
80
} ) ;
75
81
compiler . hooks . normalModuleFactory . tap (
76
82
NativeWebpackPlugin . name ,
@@ -208,3 +214,7 @@ ${cases.join(os.EOL)}
208
214
throw new Error(\`unhandled module: "\${jsModule}"\`);
209
215
}` . trim ( ) ;
210
216
} ;
217
+
218
+ const conhostWindowsReplacement = ( nativePath : string = '.' ) : string => `
219
+ module.exports = __non_webpack_require__('${ nativePath } /native/conpty.node');
220
+ ` ;
You can’t perform that action at this time.
0 commit comments