Skip to content

Commit 38711ee

Browse files
Fix process not being available for some external libraries (like path-browserify)
1 parent d633bdd commit 38711ee

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

newIDE/app/src/BrowserApp.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ import CloudStorageProvider from './ProjectsStorage/CloudStorageProvider';
2828
import BrowserResourceMover from './ProjectsStorage/ResourceMover/BrowserResourceMover';
2929
import BrowserResourceFetcher from './ProjectsStorage/ResourceFetcher/BrowserResourceFetcher';
3030

31+
// Make sure that the process object is available, even if we are not in Node.
32+
// This is needed by some libraries like path-browserify for example.
33+
// and it avoids hard crashes when using them.
34+
global.process = global.process || {
35+
cwd: () => '/',
36+
};
37+
3138
export const create = (authentication: Authentication) => {
3239
Window.setUpContextMenu();
3340

@@ -81,7 +88,9 @@ export const create = (authentication: Authentication) => {
8188
resourceMover={BrowserResourceMover}
8289
resourceFetcher={BrowserResourceFetcher}
8390
getStorageProviderOperations={getStorageProviderOperations}
84-
getStorageProviderResourceOperations={getStorageProviderResourceOperations}
91+
getStorageProviderResourceOperations={
92+
getStorageProviderResourceOperations
93+
}
8594
getStorageProvider={getStorageProvider}
8695
resourceSources={browserResourceSources}
8796
resourceExternalEditors={browserResourceExternalEditors}

0 commit comments

Comments
 (0)