diff --git a/packages/core/cli/package.json b/packages/core/cli/package.json index b7073859b..dadd30395 100644 --- a/packages/core/cli/package.json +++ b/packages/core/cli/package.json @@ -19,7 +19,7 @@ "scripts": { "build": "rimraf dist && rollup -c", "dev": "rollup -c --watch --watch.include 'src/**' -m inline", - "prepare": "rimraf dist && BUILD_NO_DTS=1 rollup -c --silent", + "prepare": "rimraf dist && cross-env BUILD_NO_DTS=1 rollup -c --silent", "typecheck": "tsc --noEmit" }, "dependencies": { @@ -52,6 +52,7 @@ "@types/lodash": "^4.17.5", "@types/node": "20.14.2", "@types/semver": "^7.5.8", + "cross-env": "^7.0.3", "rimraf": "^5.0.5", "rollup": "^4.14.1", "rollup-plugin-dts": "^6.1.0", diff --git a/packages/core/cli/src/util.ts b/packages/core/cli/src/util.ts index 82a52f17a..155da8147 100644 --- a/packages/core/cli/src/util.ts +++ b/packages/core/cli/src/util.ts @@ -15,7 +15,7 @@ import { import { readFile, writeFile } from 'fs/promises'; import { createRequire } from 'module'; import { Socket } from 'net'; -import { dirname, join, resolve, sep } from 'path'; +import { dirname, join, resolve, sep, win32 } from 'path'; import chalk from 'chalk'; import { config } from 'dotenv'; @@ -208,7 +208,12 @@ export function generateAppDir() { } process.env.APP_PACKAGE_ROOT = appDevDir; } else { - process.env.APP_PACKAGE_ROOT = appPkgPath; + if (win32.isAbsolute(appPkgPath)) { + // windows /c:/xxx + process.env.APP_PACKAGE_ROOT = appPkgPath.substring(1); + } else { + process.env.APP_PACKAGE_ROOT = appPkgPath; + } } buildIndexHtml(); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5004e3da9..2b92e4bc5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -440,6 +440,9 @@ importers: '@types/semver': specifier: ^7.5.8 version: 7.5.8 + cross-env: + specifier: ^7.0.3 + version: 7.0.3 rimraf: specifier: ^5.0.5 version: 5.0.5