Skip to content

Commit 395e926

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

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

newIDE/app/src/BrowserApp.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ 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+
env: {},
36+
cwd: () => '/',
37+
};
38+
3139
export const create = (authentication: Authentication) => {
3240
Window.setUpContextMenu();
3341

@@ -81,7 +89,9 @@ export const create = (authentication: Authentication) => {
8189
resourceMover={BrowserResourceMover}
8290
resourceFetcher={BrowserResourceFetcher}
8391
getStorageProviderOperations={getStorageProviderOperations}
84-
getStorageProviderResourceOperations={getStorageProviderResourceOperations}
92+
getStorageProviderResourceOperations={
93+
getStorageProviderResourceOperations
94+
}
8595
getStorageProvider={getStorageProvider}
8696
resourceSources={browserResourceSources}
8797
resourceExternalEditors={browserResourceExternalEditors}

0 commit comments

Comments
 (0)