File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // No-op for browser mocks
2+ export default { } ;
3+ export const watch = ( ) => ( { on : ( ) => { } , close : ( ) => { } } ) ;
4+ export const promises = { } ;
5+ export const constants = { } ;
6+ export const readFileSync = ( ) => '' ;
7+ export const statSync = ( ) => ( { isFile : ( ) => false , isDirectory : ( ) => false } ) ;
8+ export const existsSync = ( ) => false ;
9+ export const join = ( ...args : string [ ] ) => args . join ( '/' ) ;
10+ export const resolve = ( ...args : string [ ] ) => args . join ( '/' ) ;
11+ export const dirname = ( ) => '' ;
12+ export const basename = ( ) => '' ;
13+ export const extname = ( ) => '' ;
14+ export const inspect = ( ) => '' ;
15+ export const inherits = ( ) => { } ;
16+ export const EventEmitter = class { on ( ) { } emit ( ) { } } ;
17+ export const platform = 'browser' ;
18+ export const cwd = ( ) => '/' ;
19+ export const env = { } ;
Original file line number Diff line number Diff line change @@ -26,8 +26,15 @@ export default defineConfig({
2626 'os' : path . resolve ( __dirname , './mocks/node-polyfills.ts' ) ,
2727 'crypto' : path . resolve ( __dirname , './mocks/node-polyfills.ts' ) ,
2828 'url' : path . resolve ( __dirname , './mocks/node-polyfills.ts' ) ,
29+ // Fix for chokidar in browser
30+ 'chokidar' : path . resolve ( __dirname , './src/mocks/noop.ts' ) ,
2931 }
3032 } ,
33+ define : {
34+ 'process.env' : { } ,
35+ 'process.cwd' : '() => "/"' ,
36+ 'process.platform' : '"browser"'
37+ } ,
3138 plugins : [ react ( ) ] ,
3239 server : {
3340 port : 3000 ,
You can’t perform that action at this time.
0 commit comments