Skip to content

Commit

Permalink
fix: avoid using file urls for normalized paths in options
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 13, 2023
1 parent ed3a480 commit 7517293
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { pathToFileURL } from "node:url";
import { resolve, join, isAbsolute } from "pathe";
import { resolve, join, normalize } from "pathe";
import { loadConfig } from "c12";
import { klona } from "klona/full";
import { camelCase } from "scule";
Expand Down Expand Up @@ -218,16 +217,6 @@ export async function loadOptions(
);
}

// Normalise absolute auto-import paths for windows machines
if (options.imports && options.dev) {
options.imports.imports = options.imports.imports || [];
for (const entry of options.imports.imports) {
if (isAbsolute(entry.from)) {
entry.from = pathToFileURL(entry.from).href;
}
}
}

// Add h3 auto imports preset
if (options.imports) {
const h3Exports = await resolveModuleExportNames("h3", {
Expand Down Expand Up @@ -329,13 +318,7 @@ export async function loadOptions(
}

// Resolve plugin paths
options.plugins = options.plugins.map((p) => {
const path = resolvePath(p, options);
if (options.dev && isAbsolute(path)) {
return pathToFileURL(path).href;
}
return path;
});
options.plugins = options.plugins.map((p) => resolvePath(p, options));

return options;
}
Expand Down

0 comments on commit 7517293

Please sign in to comment.