Skip to content

Commit

Permalink
fix: Revert "Validate entrypoints after hooks have modified them (54b…
Browse files Browse the repository at this point in the history
…af21)"

This reverts commit 54baf21.
  • Loading branch information
aklinker1 committed Nov 25, 2024
1 parent 54baf21 commit a2924d8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/wxt/src/core/utils/building/find-entrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export async function findEntrypoints(): Promise<Entrypoint[]> {
return results;
}, []);

// Validation
preventNoEntrypoints(entrypointInfos);
preventDuplicateEntrypointNames(entrypointInfos);

// Import entrypoints to get their config
let hasBackground = false;
const env = createExtensionEnvironment();
Expand Down Expand Up @@ -170,10 +174,6 @@ export async function findEntrypoints(): Promise<Entrypoint[]> {
wxt.logger.debug(`${wxt.config.browser} entrypoints:`, targetEntrypoints);
await wxt.hooks.callHook('entrypoints:resolved', wxt, targetEntrypoints);

// Validation
preventNoEntrypoints(targetEntrypoints);
preventDuplicateEntrypointNames(targetEntrypoints);

return targetEntrypoints;
}

Expand All @@ -187,7 +187,7 @@ interface EntrypointInfo {
skipped: boolean;
}

function preventDuplicateEntrypointNames(files: Entrypoint[]) {
function preventDuplicateEntrypointNames(files: EntrypointInfo[]) {
const namesToPaths = files.reduce<Record<string, string[]>>(
(map, { name, inputPath }) => {
map[name] ??= [];
Expand Down Expand Up @@ -216,7 +216,7 @@ function preventDuplicateEntrypointNames(files: Entrypoint[]) {
}
}

function preventNoEntrypoints(files: Entrypoint[]) {
function preventNoEntrypoints(files: EntrypointInfo[]) {
if (files.length === 0) {
throw Error(`No entrypoints found in ${wxt.config.entrypointsDir}`);
}
Expand Down

0 comments on commit a2924d8

Please sign in to comment.