Skip to content

Commit

Permalink
revert how viteConfig is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
pzmosquito committed Dec 18, 2024
1 parent 3246faf commit 67da5e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ const resolveSync = (source, resolveOptions, label) => {
exports.interfaceVersion = 2;

exports.resolve = (source, file, config) => {
const { viteConfig } = config;
if (!viteConfig) {
throw new Error("'viteConfig' option must be a vite config object.");
}

log("\nin file:\t", file);

if (resolve.isCore(source)) {
log("resolved:\t", source);
return { found: true, path: null };
}

const { viteConfig } = config;
if (!viteConfig) {
throw new Error("'viteConfig' option must be a vite config object.");
}

const defaultExtensions = [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"];
const { alias, extensions = defaultExtensions } = viteConfig.resolve ?? {};
const resolveOptions = { basedir: path.dirname(file), extensions };
Expand Down

0 comments on commit 67da5e2

Please sign in to comment.