Skip to content

Commit

Permalink
fix(options): add unwasm condition when experimental.wasm is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 28, 2024
1 parent ab6c6a9 commit 376658c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ export async function loadOptions(
// Export conditions
options.exportConditions = _resolveExportConditions(
options.exportConditions,
{ dev: options.dev, node: options.node }
{ dev: options.dev, node: options.node, wasm: options.experimental.wasm }
);

// Add open-api endpoint
Expand Down Expand Up @@ -524,7 +524,7 @@ export function normalizeRouteRules(

function _resolveExportConditions(
conditions: string[] = [],
opts: { dev: boolean; node: boolean }
opts: { dev: boolean; node: boolean; wasm: boolean }
) {
const resolvedConditions: string[] = [];

Expand Down Expand Up @@ -553,7 +553,12 @@ function _resolveExportConditions(
);
}

// 4. Add default conditions
// 4. Add unwasm conditions
if (opts.wasm) {
resolvedConditions.push("wasm", "unwasm");
}

// 5. Add default conditions
resolvedConditions.push("import", "default");

// Dedup with preserving order
Expand Down

0 comments on commit 376658c

Please sign in to comment.