Unable to use koa packages
LengJunT opened this issue · 5 comments
LengJunT commented
System:macos Ventura 13.5
Node: v16.20.2
pnpm: v8.7.1
An error will be reported after using koa
, @ koa/ router
, @ koa/ bodyparser
, @ koa/ cors
, @ koa/ multer
build.
使用
koa
,@koa/router
,@koa/bodyparser
,@koa/cors
,@koa/multer
build之后运行会报错。
main/index.ts
import Koa from 'koa';
import Router from '@koa/router';
import bodyParser from '@koa/bodyparser';
import cors from '@koa/cors';
import multer from '@koa/multer';
const koaApp = new Koa();
const router = new Router();
koaApp
.use(cors({ exposeHeaders: '*' }))
.use(bodyParser())
.use(router.routes())
.use(router.allowedMethods());
router.get('/test', (ctx) => {
ctx.body = 'test';
});
package.json
"dependencies": {
"@koa/bodyparser": "^5.0.0",
"@koa/cors": "^5.0.0",
"@koa/multer": "^3.0.2",
"@koa/router": "^12.0.1",
"electron-updater": "^6.1.1",
"koa": "^2.15.0",
"koa-body": "^6.0.1",
"multer": "1.4.5-lts.1"
},
RSS1102 commented
😕看起来似乎没有问题,请提供最小复现代码仓库链接。
LengJunT commented
😕看起来似乎没有问题,请提供最小复现代码仓库链接。
拉下来编译后的产物无法运行。就是模版代码拉下来引入了koa的文件。
https://github.com/LengJunT/electron-vite-react-koa
RSS1102 commented
LengJunT commented
RSS1102 commented