[BUG] - process is undefined on Angular
pl4yradam opened this issue · 5 comments
When running Angular projects now using the package, the latest 3.3 fix from this commit breaks it
Angular runs in the browser and doesn't have a concept of process. Can this be reverted?
Temporary solutions:
- Reverting to previous version
- Defining Globals for process, however that is not correct for client side development practices.
Error dump:
Uncaught ReferenceError: process is not defined at 5006 (JSEncrypt.js:3:15) at __webpack_require__ (bootstrap:19:1) at 1287 (JSEncryptRSAKey.js:320:28) at __webpack_require__ (bootstrap:19:1) at 1677 (router.mjs:6124:1) at __webpack_require__ (bootstrap:19:1) at 6747 (app.component.html:5:7) at __webpack_require__ (bootstrap:19:1) at 4431 (environment.ts:14:3) at __webpack_require__ (bootstrap:19:1)
also in vue, someone add process vars in the latest version 3.30
We noticed this error on the project too, after doing some search about it, I found a workaround
and added the following code inside to <angular_project>/src/polyfills.ts
(window as any).process = {env: {}}; // added global env variable
resolved the problem!
We noticed this error on the project too, after doing some search about it, I found a workaround and added the following code inside to <angular_project>/src/polyfills.ts
(window as any).process = {env: {}}; // added global env variable
resolved the problem!
This shouldnt be needed for client side development, overwriting global behavior is a plaster not a fix
We noticed this error on the project too, after doing some search about it, I found a workaround and added the following code inside to <angular_project>/src/polyfills.ts
(window as any).process = {env: {}}; // added global env variable
resolved the problem!
This shouldnt be needed for client side development, overwriting global behavior is a plaster not a fix
I Agree with you, my friend found a better solution, setting the version of the lib in package.json without the bug is better, have a great day!
We noticed this error on the project too, after doing some search about it, I found a workaround and added the following code inside to <angular_project>/src/polyfills.ts
(window as any).process = {env: {}}; // added global env variable
resolved the problem!This shouldnt be needed for client side development, overwriting global behavior is a plaster not a fix
I Agree with you, my friend found a better solution, setting the version of the lib in angular.json without the bug is better, have a great day!
That will indeed work on a per project basis e.g. setting package.json to "jsencrypt": "3.2.1"
this will allow it to work, however with peer dependencies working on multiple projects at one with internal packages, this will break.
Glad that solution has worked for you 👍 Reverting the version is a good short term fix