更新 Angular 后,我们得到“进程未定义”

cpi*_*ock 5 typescript webpack angular

我们已使用 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'.
Run Code Online (Sandbox Code Playgroud)

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

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)
Run Code Online (Sandbox Code Playgroud)

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

mic*_*czy 11

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

(window as any).process = {
  env: { DEBUG: undefined },
};
Run Code Online (Sandbox Code Playgroud)