fix: windows环境无法运行 (#1535)

Co-authored-by: TomyJan <tomyjan6@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1535
Co-authored-by: Toby <2287769986@qq.com>
Co-committed-by: Toby <2287769986@qq.com>
This commit is contained in:
Toby 2024-09-13 14:45:00 +08:00 committed by TomyJan
parent 4feee19818
commit f25fb09230
3 changed files with 12 additions and 3 deletions

View File

@ -19,7 +19,7 @@
"scripts": { "scripts": {
"build": "rimraf dist && rollup -c", "build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch --watch.include 'src/**' -m inline", "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" "typecheck": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
@ -52,6 +52,7 @@
"@types/lodash": "^4.17.5", "@types/lodash": "^4.17.5",
"@types/node": "20.14.2", "@types/node": "20.14.2",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"cross-env": "^7.0.3",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"rollup": "^4.14.1", "rollup": "^4.14.1",
"rollup-plugin-dts": "^6.1.0", "rollup-plugin-dts": "^6.1.0",

View File

@ -15,7 +15,7 @@ import {
import { readFile, writeFile } from 'fs/promises'; import { readFile, writeFile } from 'fs/promises';
import { createRequire } from 'module'; import { createRequire } from 'module';
import { Socket } from 'net'; import { Socket } from 'net';
import { dirname, join, resolve, sep } from 'path'; import { dirname, join, resolve, sep, win32 } from 'path';
import chalk from 'chalk'; import chalk from 'chalk';
import { config } from 'dotenv'; import { config } from 'dotenv';
@ -207,9 +207,14 @@ export function generateAppDir() {
}); });
} }
process.env.APP_PACKAGE_ROOT = appDevDir; process.env.APP_PACKAGE_ROOT = appDevDir;
} else {
if (win32.isAbsolute(appPkgPath)) {
// windows /c:/xxx
process.env.APP_PACKAGE_ROOT = appPkgPath.substring(1);
} else { } else {
process.env.APP_PACKAGE_ROOT = appPkgPath; process.env.APP_PACKAGE_ROOT = appPkgPath;
} }
}
buildIndexHtml(); buildIndexHtml();
} }

View File

@ -440,6 +440,9 @@ importers:
'@types/semver': '@types/semver':
specifier: ^7.5.8 specifier: ^7.5.8
version: 7.5.8 version: 7.5.8
cross-env:
specifier: ^7.0.3
version: 7.0.3
rimraf: rimraf:
specifier: ^5.0.5 specifier: ^5.0.5
version: 5.0.5 version: 5.0.5