Skip to content

Commit 821b8fa

Browse files
committed
fix: 修复dev/build/serve脚本无法在 Windows 平台正常执行
1 parent d655609 commit 821b8fa

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

@@ -77,6 +78,7 @@ async function runBuild(packageName: string, script: string): Promise<void> {
7778
childProcess = spawn('pnpm', ['--filter', packageName, 'run', script], {
7879
stdio: 'inherit',
7980
cwd: rootDir,
81+
shell: isWindows,
8082
})
8183

8284
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

@@ -77,6 +78,7 @@ async function runServe(packageName: string, script: string): Promise<void> {
7778
childProcess = spawn('pnpm', ['--filter', packageName, 'run', script], {
7879
stdio: 'inherit',
7980
cwd: rootDir,
81+
shell: isWindows,
8082
})
8183

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

0 commit comments

Comments
 (0)