Skip to content

prerender插件在编译报错时,能否被抓到 #76

@stoneyallen

Description

@stoneyallen

What happens?

prerender需要在ssr的node环境里编译好资源,如果在调用window对象的api时,例如window.location直接写成location,会导致build出错,但并不能被捕捉到,例如写了api.onBuildFail的插件,或者process.on('uncaughtException')去监听,都不能获取到报错事件,导致build出错提醒不可控。

以下是报错内容

(node:98854) UnhandledPromiseRejectionWarning: ReferenceError: history is not defined
at Object.call (/Users/bytedance/Desktop/bytedance/ByteRangersFE/dist/src/app.ts:28:1)
at require (/Users/bytedance/Desktop/bytedance/ByteRangersFE/dist/webpack/bootstrap:19:1)
at Object.call (/Users/bytedance/Desktop/bytedance/ByteRangersFE/dist/src/pages/.umi-production/umi.js:28:13)

Expected behavior
1.希望提供一个报错的callback,能帮助捕捉prerender报错

Context

  • Umi Version 2.13.3:
  • Node Version 10:
  • Platform mac:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions