-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef5a380
commit d2ec849
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { existsSync } from 'fs'; | ||
|
||
export default (app) => { | ||
if (process.env.DACE_PATH_ROUTES && existsSync(process.env.DACE_PATH_ROUTES)) { | ||
const router = require(process.env.DACE_PATH_ROUTES); | ||
app.use(router); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import { existsSync } from 'fs'; | ||
import express from 'express'; | ||
|
||
export default (app) => { | ||
const { | ||
DACE_PATH_STATIC, | ||
DACE_PUBLIC_PATH, | ||
DACE_PATH_CLIENT_DIST | ||
} = process.env; | ||
// 当 publicPath = '/' 需要将编译目录挂载为虚拟目录(本地开发模式) | ||
if (process.env.DACE_PUBLIC_PATH === '/') { | ||
app.use(express.static(process.env.DACE_PATH_CLIENT_DIST)); | ||
if (DACE_PUBLIC_PATH === '/') { | ||
app.use(express.static(DACE_PATH_CLIENT_DIST)); | ||
} | ||
|
||
if (DACE_PATH_STATIC !== '' && existsSync(DACE_PATH_STATIC)) { | ||
app.use(express.static(DACE_PATH_STATIC)); | ||
} | ||
}; |