Skip to content

Commit 7cf493a

Browse files
committed
fix: 修复dev/build/serve脚本无法在 Windows 平台正常执行
1 parent 8bef84c commit 7cf493a

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

scripts/build.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as p from '@clack/prompts'
99

1010
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1111
const rootDir = path.resolve(__dirname, '..')
12+
const isWindows = process.platform === 'win32'
1213

1314
let childProcess: ReturnType<typeof spawn> | null = null
1415

@@ -59,6 +60,7 @@ async function runBuild(packageName: string, script: string): Promise<void> {
5960
childProcess = spawn('pnpm', ['--filter', packageName, 'run', script], {
6061
stdio: 'inherit',
6162
cwd: rootDir,
63+
shell: isWindows,
6264
})
6365

6466
childProcess.on('close', (code) => {

scripts/dev.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as p from '@clack/prompts'
99

1010
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1111
const rootDir = path.resolve(__dirname, '..')
12+
const isWindows = process.platform === 'win32'
1213

1314
let childProcess: ReturnType<typeof spawn> | null = null
1415

@@ -56,6 +57,7 @@ async function runDev(packageName: string): Promise<void> {
5657
childProcess = spawn('pnpm', ['--filter', packageName, 'run', 'dev'], {
5758
stdio: 'inherit',
5859
cwd: rootDir,
60+
shell: isWindows,
5961
})
6062

6163
childProcess.on('close', (code) => {

scripts/serve.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as p from '@clack/prompts'
99

1010
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1111
const rootDir = path.resolve(__dirname, '..')
12+
const isWindows = process.platform === 'win32'
1213

1314
let childProcess: ReturnType<typeof spawn> | null = null
1415

@@ -59,6 +60,7 @@ async function runServe(packageName: string, script: string): Promise<void> {
5960
childProcess = spawn('pnpm', ['--filter', packageName, 'run', script], {
6061
stdio: 'inherit',
6162
cwd: rootDir,
63+
shell: isWindows,
6264
})
6365

6466
childProcess.on('close', (code) => {

0 commit comments

Comments
 (0)