diff --git a/package.json b/package.json index 78f2bae..3a28590 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "private": false, "author": "Vinit Kumar (http://vinitkumar.me)", "scripts": { - "build": "tsc", + "build": "tsc -p tsconfig.prod.json", + "build:dev": "tsc", "start": "ts-node server.ts", "start:prod": "node dist/server.js", "dev": "nodemon --exec ts-node server.ts", diff --git a/server.ts b/server.ts index ca754b2..c00d5c5 100644 --- a/server.ts +++ b/server.ts @@ -70,7 +70,13 @@ const connect = async (): Promise => { const modelsPath = __dirname + '/app/models'; fs.readdirSync(modelsPath).forEach((file) => { - require(modelsPath + '/' + file); + // Only load .js or .ts files, skip .map and other files + if (file.endsWith('.js') || file.endsWith('.ts')) { + // Skip .d.ts declaration files + if (!file.endsWith('.d.ts')) { + require(modelsPath + '/' + file); + } + } }); passportConfig(passport, cfg); diff --git a/tsconfig.prod.json b/tsconfig.prod.json new file mode 100644 index 0000000..1c6c2e0 --- /dev/null +++ b/tsconfig.prod.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "sourceMap": false, + "declaration": false, + "declarationMap": false + } +} + diff --git a/vercel.json b/vercel.json index be3c4d7..f3ee6c7 100644 --- a/vercel.json +++ b/vercel.json @@ -5,33 +5,9 @@ { "src": "dist/server.js", "use": "@vercel/node" - }, - { - "src": "public/**", - "use": "@vercel/static" } ], "routes": [ - { - "src": "/css/(.*)", - "dest": "/public/css/$1" - }, - { - "src": "/js/(.*)", - "dest": "/public/js/$1" - }, - { - "src": "/img/(.*)", - "dest": "/public/img/$1" - }, - { - "src": "/font/(.*)", - "dest": "/public/font/$1" - }, - { - "src": "/webfonts/(.*)", - "dest": "/public/webfonts/$1" - }, { "src": "/(.*)", "dest": "/dist/server.js"