File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ export default autoTrace(
165
165
} as NodeJS . ProcessEnv ,
166
166
} ;
167
167
168
+ spawnOpts . env . NODE_OPTIONS = removePnpLoaderArguments ( spawnOpts . env . NODE_OPTIONS ) ;
168
169
if ( runAsNode ) {
169
170
spawnOpts . env . ELECTRON_RUN_AS_NODE = 'true' ;
170
171
} else {
@@ -231,3 +232,11 @@ export default autoTrace(
231
232
return spawned ;
232
233
}
233
234
) ;
235
+
236
+ export function removePnpLoaderArguments ( input : string | undefined ) : string | undefined {
237
+ if ( ! input ) return input ;
238
+ return input . replace (
239
+ / ( - - r e q u i r e \s + [ ^ " ] .+ \. p n p \. c j s ) | ( - - e x p e r i m e n t a l - l o a d e r \s + [ ^ " ] .+ \. p n p \. l o a d e r \. m j s ) | ( - - r e q u i r e \s + " .+ \. p n p \. c j s " ) | ( - - e x p e r i m e n t a l - l o a d e r \s + " .+ \. p n p \. l o a d e r \. m j s " ) / g,
240
+ ''
241
+ ) ;
242
+ }
Original file line number Diff line number Diff line change @@ -66,6 +66,13 @@ function getElectronModuleName(packageJSON: PackageJSONWithDeps): string {
66
66
async function getElectronPackageJSONPath ( dir : string , packageName : string ) : Promise < string | undefined > {
67
67
const nodeModulesPath = await determineNodeModulesPath ( dir , packageName ) ;
68
68
if ( ! nodeModulesPath ) {
69
+ try {
70
+ // Yarn PnP
71
+ // eslint-disable-next-line node/no-missing-require
72
+ return require . resolve ( 'electron/package.json' ) ;
73
+ } catch ( e ) {
74
+ // Ignore
75
+ }
69
76
throw new PackageNotFoundError ( packageName , dir ) ;
70
77
}
71
78
You can’t perform that action at this time.
0 commit comments