11import  {  readFile ,  readFileSync ,  readlink ,  stat  }  from  'fs' ; 
22import  babel  from  '@rollup/plugin-babel' ; 
3+ import  {  fileURLToPath  }  from  'url' ; 
34import  {  fs  }  from  'memfs' ; 
45import  {  join  }  from  'path' ; 
56import  replace  from  '@rollup/plugin-replace' ; 
67import  webpack  from  'webpack' ; 
7- import  webpackConfig  from  '../webpack/worker-es5' ; 
8+ // eslint-disable-next-line node/file-extensions-in-import 
9+ import  webpackConfig  from  '../webpack/worker-es5.mjs' ; 
810
911const  workerFile  =  readFileSync ( 'src/worker/worker.ts' ,  'utf8' ) ; 
1012const  result  =  / e x p o r t \s c o n s t \s w o r k e r \s = \s ` (?< workerString > .* ) ` ; / g. exec ( workerFile ) ; 
@@ -21,7 +23,7 @@ export default new Promise((resolve, reject) => {
2123
2224    compiler . inputFileSystem  =  { 
2325        readFile ( path ,  ...args )  { 
24-             if  ( path  ===  join ( __dirname ,   '../../src/worker.js' ) )  { 
26+             if  ( path  ===  fileURLToPath ( new   URL ( '../../src/worker.js' ,   import . meta . url ) ) )  { 
2527                args . pop ( ) ( null ,  "import 'async-array-buffer-worker';" ) ; 
2628
2729                return ; 
@@ -30,14 +32,14 @@ export default new Promise((resolve, reject) => {
3032            return  readFile ( path ,  ...args ) ; 
3133        } , 
3234        readlink ( path ,  callback )  { 
33-             if  ( path  ===  join ( __dirname ,   '../../src/worker.js' ) )  { 
34-                 return  readlink ( __filename ,  callback ) ; 
35+             if  ( path  ===  fileURLToPath ( new   URL ( '../../src/worker.js' ,   import . meta . url ) ) )  { 
36+                 return  readlink ( fileURLToPath ( new   URL ( import . meta . url ) ) ,  callback ) ; 
3537            } 
3638
3739            return  readlink ( path ,  callback ) ; 
3840        } , 
3941        stat ( path ,  ...args )  { 
40-             if  ( path  ===  join ( __dirname ,   '../../src/worker.js' ) )  { 
42+             if  ( path  ===  fileURLToPath ( new   URL ( '../../src/worker.js' ,   import . meta . url ) ) )  { 
4143                args . pop ( ) ( null ,  { 
4244                    isFile ( )  { 
4345                        return  true ; 
0 commit comments