File tree 3 files changed +9
-2
lines changed
3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export interface RunOptions {
11
11
export interface ProjectConfig {
12
12
ignore : string [ ] ;
13
13
swc ?: SwcConfig ;
14
+ esm ?: boolean ;
14
15
extensions : string [ ] ;
15
16
cacheDir : string ;
16
17
}
Original file line number Diff line number Diff line change 1
1
import type { ChildProcess , StdioOptions } from "child_process" ;
2
2
import { spawn } from "child_process" ;
3
3
import { EventEmitter , once } from "events" ;
4
+ import _ from "lodash" ;
4
5
import { setTimeout } from "timers/promises" ;
5
6
import type { RunOptions } from "./Options.js" ;
6
7
import type { Project } from "./Project.js" ;
@@ -66,6 +67,7 @@ export class Supervisor extends EventEmitter {
66
67
...process . env ,
67
68
WDS_SOCKET_PATH : this . socketPath ,
68
69
WDS_EXTENSIONS : this . project . config . extensions . join ( "," ) ,
70
+ WDS_ESM_ENABLED : _ . defaultTo ( this . project . config . esm , true ) ? "true" : "false" ,
69
71
} ,
70
72
stdio : stdio ,
71
73
detached : true ,
Original file line number Diff line number Diff line change 2
2
* Entrypoint file passed as --import to all child processes started by wds
3
3
*/
4
4
import { register } from "node:module" ;
5
+ import { debugLog } from "../SyncWorker.cjs" ;
5
6
6
7
if ( ! register ) {
7
8
throw new Error (
@@ -15,5 +16,8 @@ process.setSourceMapsEnabled(true);
15
16
// register the CJS hook to intercept require calls the old way
16
17
import "./child-process-cjs-hook.cjs" ;
17
18
18
- // register the ESM loader the new way
19
- register ( "./child-process-esm-loader.js" , import . meta. url ) ;
19
+ if ( process . env . WDS_ESM_ENABLED === "true" ) {
20
+ debugLog ?.( "registering wds ESM loader" ) ;
21
+ // register the ESM loader the new way
22
+ register ( "./child-process-esm-loader.js" , import . meta. url ) ;
23
+ }
You can’t perform that action at this time.
0 commit comments