Skip to content

Commit 34a42eb

Browse files
author
张元涛43115
committed
refactor: improve comments
1 parent 9a9eccc commit 34a42eb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/baseCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
331331
return `--import "${pathToFileURL(modulePath).href}"`;
332332
}
333333
if (os.platform() === 'win32') {
334+
// windows path need to escape backslash: `node --require "C:\\path\\to\\module"`
334335
return `--require "${path.win32.normalize(modulePath).replace(/\\/g, '\\\\')}"`;
335336
}
336337
return `--require "${modulePath}"`;

src/commands/dev.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ export default class Dev<T extends typeof Dev> extends BaseCommand<T> {
4545
const execArgv: string[] = [];
4646
for (const r of requires) {
4747
const module = this.formatImportModule(r);
48+
49+
// Remove the quotes from the path
50+
// --require "module path" -> ['--require', 'module path']
51+
// --import "module path" -> ['--import', 'module path']
4852
const splitIndex = module.indexOf(' ');
4953
if (splitIndex !== -1) {
50-
// Remove the quotes from the path
51-
// --require "module path" -> ['--require', 'module path']
52-
// --import "module path" -> ['--import', 'module path']
5354
execArgv.push(module.slice(0, splitIndex), module.slice(splitIndex + 2, -1));
5455
}
5556
}

0 commit comments

Comments
 (0)