1
0
mirror of synced 2026-03-23 02:58:34 +08:00

fix(runtime): 修复window系统下npm run playground 出错问题 #29

This commit is contained in:
roymondchen
2022-04-26 17:38:00 +08:00
committed by jia000
parent c8542367db
commit 6df8ce82a5
8 changed files with 16 additions and 5 deletions

View File

@@ -9,6 +9,8 @@
"serve": "vite preview --port 8076"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.13",
"@tmagic/stage": "^1.0.0-beta.13",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},

View File

@@ -38,6 +38,7 @@ export default defineConfig({
},
server: {
host: '0.0.0.0',
port: 8090,
},

View File

@@ -196,7 +196,8 @@ const generateEntryFile = function ({ entries, entryFile, type, componentFileAff
fs.writeFileSync(
path.resolve(entryPath(), entryFile),
prettyPrint(parse(jsString, { parser: require('recast/parsers/typescript') }), {
// window下需要将路径中\转换成/
prettyPrint(parse(jsString.replace(/\\/g, '/'), { parser: require('recast/parsers/typescript') }), {
tabWidth: 2,
trailingComma: true,
quote: 'single',
@@ -207,9 +208,10 @@ const generateEntryFile = function ({ entries, entryFile, type, componentFileAff
const installPackage = function (package) {
try {
execSync(`node -e "require.resolve('${package}')"`, { stdio: 'ignore' });
// window下需要将路径中\转换成/
execSync(`node -e "require.resolve('${package.replace(/\\/g, '/')}')"`, { stdio: 'ignore' });
} catch (e) {
execSync(`npm install ${package} --registry https://mirrors.tencent.com/npm/`, {
execSync(`npm install ${package}`, {
stdio: 'inherit',
cwd: pageRoot(),
});

View File

@@ -9,6 +9,8 @@
"serve": "vite preview --port 8077"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.13",
"@tmagic/stage": "^1.0.0-beta.13",
"@vue/composition-api": "1.0.5",
"vue": "^2.6.14"
},

View File

@@ -37,6 +37,7 @@ export default defineConfig({
},
server: {
host: '0.0.0.0',
port: 8089,
},
build: {

View File

@@ -9,6 +9,8 @@
"serve": "vite preview --port 8078"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.13",
"@tmagic/stage": "^1.0.0-beta.13",
"axios": "^0.25.0",
"vue": "^3.2.0"
},

View File

@@ -37,6 +37,7 @@ export default defineConfig({
},
server: {
host: '0.0.0.0',
port: 8089,
},
build: {