【eggjs】npm start 后,中间件中的代码一直被执行。
发布于 5 年前 作者 luckymore 2521 次浏览 来自 问答

1、中间件代码 sharp_rotate.js

'use strict'
module.exports = () => {
  return async function sharpRotate(ctx, next) {
    const start = Date.now()
    await next()
    console.log('rotate 时间消耗: ', Date.now() - start, 'ms')
  }
}

2、中间件配置 config.default.js

middleware: ['sharpRotate', 'errorHandler'],

3、执行 npm start 本地mac OS环境正常 linux-64环境中间件代码一直被执行

image.png

2 回复

带最小可复现仓库提 issue

@atian25 https://github.com/eggjs/egg/issues/3678 请您关注下,我实在是找不到问题了😭

回到顶部