Skip to content
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

Restoring the process variable in the browser. #9815

Closed
ccheraa opened this issue Aug 2, 2021 · 4 comments · Fixed by #9972
Closed

Restoring the process variable in the browser. #9815

ccheraa opened this issue Aug 2, 2021 · 4 comments · Fixed by #9972
Labels
documentation issues related to documentation

Comments

@ccheraa
Copy link

ccheraa commented Aug 2, 2021

Bug Description:

Up until a recent version, Theia used to use webpack 4, which had polyfills for some node packages, including process.
After upgrading to webpack 5, which dropped the support for those polyfills, a bug surfaced when running Theia browser IDE in an Electron window.
Theia tries to access the process variable which no longer exists, and throws an exception that stops the IDE from even starting up.
It happens in:

export const MAX_FILE_SIZE_MB = environment.electron.is() ? process.arch === 'ia32' ? WIN32_MAX_FILE_SIZE_MB : GENERAL_MAX_FILE_SIZE_MB : 32;

Steps to Reproduce:

  1. Build the browser IDE.
  2. Browse to its url in an Electron window

Additional Information

I have mentioned this bug before with a work around for Cypress, in #9751
We managed to fix it by including the process variable again using Webpack Config file.
Check evolvedbinary/fusion-studio-extension#472
I think this should be included in the changelog/migration guide.

  • Theia Version: 1.15.0
@vince-fugnitto vince-fugnitto added the documentation issues related to documentation label Aug 2, 2021
@adamretter
Copy link
Contributor

adamretter commented Aug 2, 2021

CC @duncdrum @marmoure

@vince-fugnitto
Copy link
Member

@ccheraa I added a general entry about webpack in the draft migration guide (#9817).

I don't think we should be specific in the guide to include the update mentioned in the issue as running the browser instance in electron is not a standard or supported use-case by the framework. It's also virtually impossible for the framework to anticipate some of the things that downstream applications might do or perform like this use-case.

@ccheraa
Copy link
Author

ccheraa commented Aug 2, 2021

I know it's not a standard use-case, yet it showed that the process variable, is not always present when the app is run on Electron.
I believe, at least this should be addressed, and fixed.
As far as I know, that's the only instance of the problem:

export const MAX_FILE_SIZE_MB = environment.electron.is() ? process.arch === 'ia32' ? WIN32_MAX_FILE_SIZE_MB : GENERAL_MAX_FILE_SIZE_MB : 32;

I actually think that using the process variable only when it should exist is better than providing it where it shouldn't be available, which sounds like a waorkaround.

@vince-fugnitto
Copy link
Member

I know it's not a standard use-case, yet it showed that the process variable, is not always present when the app is run on Electron. I believe, at least this should be addressed, and fixed.

@ccheraa if you believe it is something to be fixed in the framework, please feel free to contribute a pull-request 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation issues related to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants