-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReferenceError: process is not defined #329
Comments
Does it happen in the latest version? 1.5.x or newer? |
I could verify with the Autorest people, but I think they recommend to use the versions defined in the compatibility in their README for the desired version. For their latest versions, they are referencing |
@felpel, as we own autorest.typescript as well, I'll verify and update the @azure/ms-rest-js version there as well. If you could try updating it manually and see if it reproduces in the meantime, I'd appreciate it. |
Even at
If I install the import * as process from "process";
(window as any).process = process; However, even if it might be an acceptable workaround, the Angular team removed the shims for Node's global types in v6.0 because those types are not meant to be used in the browser. |
Is the Angular app run in a browser or Node.js? Can you share a sample project for that? |
The application is run in a browser. I don't want to leak important details about any of our API in production, but I could try to generate a dummy service, use its generated Swagger definitions with Autorest and finally check if the error occurs without the polyfill. Let me check if I can create a sample project for you. |
@kpajdzik I've generated a new Angular application at its latest version with the minimal stuff at felpel/reproc on the master branch. Run in order:
You should see the reference error in the console. I've also made a separate |
@felpel Thanks so much for the project! I followed the described steps and I get Should this fail before? Nothing really happens afterwards. |
@kpajdzik forgot to mention to open your browser at |
I can see that the project uses Node.js bundle. This bundle assumes it is run out of the browser so modules like I don't know Angular too well, is there any way to force it to load the browser bundle (i.e. msRest.browser.js)? |
Is there any progress on this issue? I'm currently experiencing this issue with my Angular project. |
How do you import ms-rest-js into your Angular project? |
Hi! Tell me, please, did you manage to solve this problem? |
I had the same problem using stencil.js and autorest. After searching for a while I found out that since stencil uses rollup to bundle, it doesn't provide node globals per default. Tools like webpack and browserify seem to provide globals such as "process" during bundling by default. |
Update: seems to be related to #326
Package Version: 1.2.0
Browser
- name/version: Chrome 71, Firefox 64
Describe the bug
After updating
autorest.typescript
in our Angular application (v7.2.0
) to its current latest version, I had to bumpms-rest-js
to1.2.0
. After dealing with compilation errors, I'm getting the following runtime error (Chrome's stacktrace):To Reproduce
Not sure exactly how it can be exactly reproduced since the code is autogenerated based on my API, but at least have the following dependencies for Autorest's generation.
A previous call made to one of the generated API method is triggering this error.
Expected behavior
I should be able to use the tool without trying to set a polyfill for
process
as it would be suggested here or define it on the window as suggested hereScreenshots
N/A
Additional context
The text was updated successfully, but these errors were encountered: