(code, id)
| 50 | { |
| 51 | name: 'worker-import-meta-handler', |
| 52 | transform(code, id) { |
| 53 | // Replace import.meta.dirname with a static value for workers |
| 54 | if (code.includes('import.meta.dirname')) { |
| 55 | code = code.replace(/import\.meta\.dirname/g, '""'); |
| 56 | } |
| 57 | // Replace import.meta.url with a static value for workers |
| 58 | if (code.includes('import.meta.url')) { |
| 59 | code = code.replace(/import\.meta\.url/g, '"file:///app/"'); |
| 60 | } |
| 61 | return code; |
| 62 | }, |
| 63 | }, |
| 64 | ]; |
| 65 | } |