Angular 6 - process is not defined when trying to serve application

后端 未结 5 1852
心在旅途
心在旅途 2020-11-30 08:43

I am getting the following error when I try to serve my angular 6 application using cosmicjs:

Uncaught ReferenceError: process is not defined
    at Object..         


        
5条回答
  •  情书的邮戳
    2020-11-30 09:42

    In polyfill.ts, add this line:

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

    Reference: https://github.com/algolia/algoliasearch-client-javascript/issues/691


    Or npm i -S process, then add this to polyfill.ts:

    import * as process from 'process';
    window['process'] = process;
    

提交回复
热议问题