Skip to content

Commit 376658c

Browse files
committed
fix(options): add unwasm condition when experimental.wasm is enabled
1 parent ab6c6a9 commit 376658c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/options.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export async function loadOptions(
378378
// Export conditions
379379
options.exportConditions = _resolveExportConditions(
380380
options.exportConditions,
381-
{ dev: options.dev, node: options.node }
381+
{ dev: options.dev, node: options.node, wasm: options.experimental.wasm }
382382
);
383383

384384
// Add open-api endpoint
@@ -524,7 +524,7 @@ export function normalizeRouteRules(
524524

525525
function _resolveExportConditions(
526526
conditions: string[] = [],
527-
opts: { dev: boolean; node: boolean }
527+
opts: { dev: boolean; node: boolean; wasm: boolean }
528528
) {
529529
const resolvedConditions: string[] = [];
530530

@@ -553,7 +553,12 @@ function _resolveExportConditions(
553553
);
554554
}
555555

556-
// 4. Add default conditions
556+
// 4. Add unwasm conditions
557+
if (opts.wasm) {
558+
resolvedConditions.push("wasm", "unwasm");
559+
}
560+
561+
// 5. Add default conditions
557562
resolvedConditions.push("import", "default");
558563

559564
// Dedup with preserving order

0 commit comments

Comments
 (0)