@@ -9,7 +9,7 @@ import fs from 'node:fs' // 添加fs模块用于读取证书文件
99import path from 'node:path'
1010import zlib from 'node:zlib'
1111import { fileURLToPath } from 'node:url'
12- import { getLocalIP , findAvailablePort , generateSelfSignedCert } from '../../utils/utils.mjs' // 添加证书生成函数
12+ import { getLocalIP , findAvailablePort , generateSelfSignedCert , isDev } from '../../utils/utils.mjs' // 添加证书生成函数
1313import useApi from './api/index.mjs'
1414import { t } from '../../../i18n/server.js'
1515import setupSocketIO from './socket/index.mjs'
@@ -32,7 +32,6 @@ export default async ({
3232 let ioServer
3333 try {
3434 const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
35- const isProduction = process . env . NODE_ENV === 'production'
3635 port = await findAvailablePort ( port )
3736 host = getLocalIP ( )
3837
@@ -130,9 +129,9 @@ export default async ({
130129 } )
131130 )
132131 // 处理H5静态资源地址
133- const staticPath = isProduction
134- ? path . resolve ( process . env . FBW_RESOURCES_PATH , './h5' )
135- : path . resolve ( __dirname , '. ./h5' )
132+ const staticPath = isDev ( )
133+ ? path . resolve ( __dirname , '. ./h5' )
134+ : path . resolve ( process . env . FBW_RESOURCES_PATH , './h5' )
136135 logger . info ( `[H5Server] INFO => H5静态资源路径: ${ staticPath } ` )
137136 // 提供静态资源服务
138137 app . use (
0 commit comments