mirror of
https://github.com/zoriya/v10.git
synced 2026-08-05 13:48:14 +00:00
fix(packages): add server-only bundles (#1349)
This commit is contained in:
@@ -163,6 +163,7 @@ async function measure(entryPoints, external = []) {
|
||||
write: false,
|
||||
outdir: '/tmp/bundle-size-out',
|
||||
external,
|
||||
conditions: ['browser'],
|
||||
logLevel: 'silent',
|
||||
});
|
||||
|
||||
@@ -199,6 +200,7 @@ async function measureVirtual(code, resolveDir, external = []) {
|
||||
write: false,
|
||||
outdir: '/tmp/bundle-size-out',
|
||||
external,
|
||||
conditions: ['browser'],
|
||||
logLevel: 'silent',
|
||||
});
|
||||
|
||||
@@ -213,12 +215,17 @@ async function measureVirtual(code, resolveDir, external = []) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the `default` condition from an export value.
|
||||
* Handles both `{ default: "./dist/..." }` objects and plain string values.
|
||||
* Resolve the browser production path from an export value.
|
||||
*
|
||||
* Prefers `browser.default` (browser prod bundle) over top-level `default`
|
||||
* (server bundle) so we measure the code consumers actually ship.
|
||||
*/
|
||||
function resolveDefault(exportValue) {
|
||||
if (typeof exportValue === 'string') return exportValue;
|
||||
if (typeof exportValue === 'object' && exportValue !== null) {
|
||||
if (typeof exportValue.browser === 'object' && exportValue.browser !== null) {
|
||||
return exportValue.browser.default ?? exportValue.default ?? null;
|
||||
}
|
||||
return exportValue.default ?? null;
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user