Skip to content

Commit c5ee51e

Browse files
committed
Revert "fix: workaround import.meta.ROLLUP_FILE_URL_xxx"
This reverts commit f52fc38.
1 parent 139e2a8 commit c5ee51e

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

examples/web-worker/vite.config.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default defineConfig((_env) => ({
1010
react(),
1111
vitePluginWorkerEnvironment(),
1212
vitePluginFetchModuleServer(),
13-
rolldownPluginRollupFileUrl(),
1413
],
1514
environments: {
1615
client: {
@@ -219,41 +218,3 @@ function PromiseWithReoslvers<T>(): PromiseWithResolvers<T> {
219218
});
220219
return { promise, resolve, reject };
221220
}
222-
223-
// workaround until https://github.com/rolldown/rolldown/pull/3488
224-
import path from "node:path";
225-
function rolldownPluginRollupFileUrl(): Plugin {
226-
return {
227-
name: rolldownPluginRollupFileUrl.name,
228-
renderChunk: {
229-
order: "pre",
230-
handler(code, chunk) {
231-
if (!code.includes("import.meta.ROLLUP_FILE_URL_")) {
232-
return;
233-
}
234-
const matches = code.matchAll(/import.meta.ROLLUP_FILE_URL_(\w+)/dg);
235-
const output = new MagicString(code);
236-
for (const match of matches) {
237-
const referenceId = match[1]!;
238-
const assetFileName = this.getFileName(referenceId);
239-
const relativePath =
240-
"./" +
241-
path.relative(
242-
path.resolve(chunk.fileName, ".."),
243-
path.resolve(assetFileName),
244-
);
245-
const replacement = `new URL(${JSON.stringify(relativePath)}, import.meta.url)`;
246-
const [start, end] = match.indices![0]!;
247-
output.update(start, end, replacement);
248-
}
249-
if (output.hasChanged()) {
250-
return {
251-
code: output.toString(),
252-
map: output.generateMap({ hires: "boundary" }),
253-
};
254-
}
255-
return;
256-
},
257-
},
258-
};
259-
}

0 commit comments

Comments
 (0)