【问题标题】:After updating Angular we get a "process is not defined"更新 Angular 后,我们得到一个“未定义进程”
【发布时间】:2021-10-09 06:33:41
【问题描述】:

我们已使用 Angular 网站上的迁移步骤将 Angular 7 应用程序更新为 Angular 12。 npm start 上的 Angular CLI 只给我们一个警告

'node-sass' usage is deprecated and will be removed in a future major version. To opt-out of the deprecated behaviour and start using 'sass' uninstall 'node-sass'.

但是如果我们启动我们的应用程序,我们会收到以下错误:

util.js:109 Uncaught ReferenceError: process is not defined
at Object.71732 (util.js:109)
at __webpack_require__ (bootstrap:19)
at Module.77741 (documents.component.ts:19)
at __webpack_require__ (bootstrap:19)
at Module.86100 (list.component.ts:9)
at __webpack_require__ (bootstrap:19)
at Module.15204 (sysbiz.service.ts:10)
at __webpack_require__ (bootstrap:19)
at Module.65790 (not-found.component.ts:10)
at __webpack_require__ (bootstrap:19)

还没有找到任何东西我该如何解决这个问题,我得到一个空白页。

【问题讨论】:

    标签: angular typescript webpack


    【解决方案1】:

    将以下内容添加到您的 polyfill.ts 文件中:

    (window as any).process = {
      env: { DEBUG: undefined },
    };
    

    【讨论】:

      猜你喜欢
      • 2019-10-15
      • 2017-06-20
      • 2017-01-18
      • 2019-11-05
      • 2013-12-16
      • 1970-01-01
      • 1970-01-01
      • 2017-12-12
      • 2020-10-18
      相关资源
      最近更新 更多