Skip to content

Commit

Permalink
fix: 修复因编译机和运行机不是同一台导致的路由挂载无效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongzhi107 committed Dec 4, 2019
1 parent fff23ea commit 98c23b9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/runtime/utils/addRoutes.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
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);
if (process.env.DACE_PATH_ROUTES) {
try {
const router = require(process.env.DACE_PATH_ROUTES);
app.use(router);
} catch (e) {
console.error(`DACE_PATH_ROUTES not exist. ${e}`);
}
}
};

0 comments on commit 98c23b9

Please sign in to comment.