Remove file:// Deno-ism from plug compiler

- Drop file:// URL prefix from generated plug imports; use plain
  absolute paths instead (esbuild resolves these natively)
- Remove the file-url-resolver esbuild plugin that was only needed
  to strip that prefix
This commit is contained in:
Zef Hemel
2026-02-27 16:08:31 +01:00
parent 42ff234801
commit 9e49794ac8
+1 -13
View File
@@ -72,7 +72,7 @@ ${
// Resolve path
filePath = path.join(rootPath, filePath);
return `import {${jsFunctionName} as ${funcName}} from "file://${
return `import {${jsFunctionName} as ${funcName}} from "${
// Replacing \ with / for Windows
path.resolve(filePath).replaceAll(
"\\",
@@ -119,18 +119,6 @@ setupMessageListener(functionMapping, manifest, self.postMessage);
outfile: outFile,
metafile: options.info,
treeShaking: true,
plugins: [
// Simple plugin to handle file:// URLs
{
name: "file-url-resolver",
setup(build: esbuild.PluginBuild) {
build.onResolve({ filter: /^file:\/\// }, (args: esbuild.OnResolveArgs) => {
const filePath = args.path.replace(/^file:\/\//, "");
return { path: filePath };
});
},
},
],
});
if (options.info) {