File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
packages/app/src/sandbox/eval/transpilers/babel/worker Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ let lastConfig = null;
2626
2727const IGNORED_MODULES = [ 'util' , 'os' ] ;
2828
29+ // Default in memory
30+ BrowserFS . configure ( { fs : 'InMemory' } , ( ) => { } ) ;
31+
2932self . process = {
3033 env : { NODE_ENV : 'production' } ,
3134 platform : 'linux' ,
@@ -34,11 +37,6 @@ self.process = {
3437} ;
3538// This one is called from the babel transpiler and babel-plugin-macros
3639self . require = path => {
37- const module = BrowserFS . BFSRequire ( path ) ;
38- if ( module ) {
39- return module ;
40- }
41-
4240 if ( path === 'assert' ) {
4341 return require ( 'assert' ) ;
4442 }
@@ -51,6 +49,21 @@ self.require = path => {
5149 } ;
5250 }
5351
52+ if ( path === 'util' ) {
53+ return require ( 'util' ) ;
54+ }
55+
56+ if ( path === 'os' ) {
57+ const os = require ( 'os-browserify' ) ;
58+ os . homedir = ( ) => '/home/sandbox' ;
59+ return os ;
60+ }
61+
62+ const module = BrowserFS . BFSRequire ( path ) ;
63+ if ( module ) {
64+ return module ;
65+ }
66+
5467 if ( IGNORED_MODULES . indexOf ( path ) > - 1 ) {
5568 return { } ;
5669 }
You can’t perform that action at this time.
0 commit comments