diff --git a/game-server/tsconfig.json b/game-server/tsconfig.json index c50b0531d..b9eac9b6d 100644 --- a/game-server/tsconfig.json +++ b/game-server/tsconfig.json @@ -24,7 +24,6 @@ "watch":false //在监视模式下运行编译器。会监视输出文件,在它们改变时重新编译。 }, "include":[ - "../shared/**/*.ts", "./app/**/*.ts", "./config/**/*.ts", "./app.ts", diff --git a/shared/statusCode.ts b/shared/consts/statusCode.ts similarity index 100% rename from shared/statusCode.ts rename to shared/consts/statusCode.ts diff --git a/web-server/app/controller/game.ts b/web-server/app/controller/game.ts index db4281eb5..42a3beab5 100644 --- a/web-server/app/controller/game.ts +++ b/web-server/app/controller/game.ts @@ -1,6 +1,6 @@ -import { SERVER_NOT_FOUND } from './../../../shared/statusCode'; -import { STATUS_SUC } from '../../../shared/statusCode'; -import { GameModel } from '../db/Game'; +import { SERVER_NOT_FOUND } from '@consts/statusCode'; +import { STATUS_SUC } from '@consts/statusCode'; +import { GameModel } from '@db/Game'; import { Controller } from 'egg'; export default class GameController extends Controller { diff --git a/web-server/app/middleware/tokenParser.ts b/web-server/app/middleware/tokenParser.ts index 854faa6bf..72af59fed 100644 --- a/web-server/app/middleware/tokenParser.ts +++ b/web-server/app/middleware/tokenParser.ts @@ -1,4 +1,4 @@ -import { STATUS_TOKEN_ERR, STATUS_WRONG_PARMS } from './../../../shared/statusCode'; +import { STATUS_TOKEN_ERR, STATUS_WRONG_PARMS } from '@consts/statusCode'; import { UserModel } from './../db/User'; module.exports = () => { diff --git a/web-server/app/service/Auth.ts b/web-server/app/service/Auth.ts index a8c9f8838..6a0aba237 100644 --- a/web-server/app/service/Auth.ts +++ b/web-server/app/service/Auth.ts @@ -1,9 +1,9 @@ -import { RoleModel } from './../db/Role'; -import { UserModel } from './../db/User'; -import { SMS_IN_60S, SMS_CNT_LIMIT, STATUS_SUC, STATUS_WRONG_PARMS, SMS_INVALID, ROLE_NOT_FOUND } from './../../../shared/statusCode'; -import { smsModel } from './../db/Sms'; +import { RoleModel } from '@db/Role'; +import { UserModel } from '@db/User'; +import { SMS_IN_60S, SMS_CNT_LIMIT, STATUS_SUC, STATUS_WRONG_PARMS, SMS_INVALID, ROLE_NOT_FOUND } from '@consts/statusCode'; +import { smsModel } from '@db/Sms'; import { Service } from 'egg'; -import Counter from '../db/Counter'; +import Counter from '@db/Counter'; const _ = require('underscore'); /** diff --git a/web-server/app/service/TurboCore.ts b/web-server/app/service/TurboCore.ts index ee34349a0..ec71c949a 100644 --- a/web-server/app/service/TurboCore.ts +++ b/web-server/app/service/TurboCore.ts @@ -1,4 +1,4 @@ -import { TURBO_CORE_URL, APP_ID, TURBO_PARM_SECRET } from './../../../shared/consts/consts'; +import { TURBO_CORE_URL, APP_ID, TURBO_PARM_SECRET } from '@consts/consts'; import { Service } from 'egg'; const crypto = require('crypto'); /** diff --git a/web-server/config/plugin.ts b/web-server/config/plugin.ts index c5011a8cf..658d56bee 100644 --- a/web-server/config/plugin.ts +++ b/web-server/config/plugin.ts @@ -1,4 +1,5 @@ import { EggPlugin } from 'egg'; +import 'tsconfig-paths/register'; const plugin: EggPlugin = { // static: true, diff --git a/web-server/tsconfig.json b/web-server/tsconfig.json index b522c82ed..bfc970cf0 100644 --- a/web-server/tsconfig.json +++ b/web-server/tsconfig.json @@ -20,7 +20,12 @@ "skipLibCheck": true, "skipDefaultLibCheck": true, "inlineSourceMap": true, - "importHelpers": true + "importHelpers": true, + "baseUrl": ".", + "paths": { + "@db/*": ["app/db/*"], + "@consts/*": ["app/consts/*"] + }, }, "exclude": [ "app/public",