MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / transform

Function transform

packages/vite/helpers/workers.ts:52–62  ·  view source on GitHub ↗
(code, id)

Source from the content-addressed store, hash-verified

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}

Callers 1

runFunction · 0.50

Calls 2

includesMethod · 0.80
replaceMethod · 0.80

Tested by 1

runFunction · 0.40