🪟 fix: Cross-Platform Absolute-Path Check in tsdown neverBundle Predicates (#13700)

The deps.neverBundle predicates in the four package tsdown configs detect
first-party (resolved) module ids with !id.startsWith('/'). On Windows,
resolved ids are absolute paths like C:\..., which never match, so every
project module is externalized. Builds still exit 0 but emit near-empty
bundles — e.g. packages/client dist/index.mjs drops from ~276 kB to
~2.7 kB and dist/style.css is never produced, breaking the client dev
server with "Failed to resolve import @librechat/client/style.css".

Replace the startsWith('/') check with path.isAbsolute(id), which is
behavior-identical on POSIX and correct on Windows.

Co-authored-by: phoenixtekk <phoenixtekk@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Lacy
2026-06-13 08:04:46 -07:00
committed by GitHub
parent 8154a31d2d
commit dea71c8396
4 changed files with 8 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
import path from 'node:path';
import { defineConfig } from 'tsdown';
export default defineConfig({
@@ -15,6 +16,6 @@ export default defineConfig({
// only first-party code: relative imports and the `~/*` tsconfig alias (-> src).
// `neverBundle` is the 0.22 replacement for the deprecated `external` option.
deps: {
neverBundle: (id) => !id.startsWith('.') && !id.startsWith('~') && !id.startsWith('/'),
neverBundle: (id) => !id.startsWith('.') && !id.startsWith('~') && !path.isAbsolute(id),
},
});

View File

@@ -1,3 +1,4 @@
import path from 'node:path';
import { defineConfig } from 'tsdown';
// Mirror the prior Rollup `@rollup/plugin-replace` substitutions: only these three are
@@ -26,7 +27,7 @@ export default defineConfig({
// Externalize every third-party import (consumers provide the peers + react/jsx-runtime);
// bundle only relative, `~`-aliased, and absolute sources.
deps: {
neverBundle: (id) => !id.startsWith('.') && !id.startsWith('~') && !id.startsWith('/'),
neverBundle: (id) => !id.startsWith('.') && !id.startsWith('~') && !path.isAbsolute(id),
onlyBundle: false,
},
});

View File

@@ -1,3 +1,4 @@
import path from 'node:path';
import { createRequire } from 'node:module';
import replace from '@rollup/plugin-replace';
import { defineConfig } from 'tsdown';
@@ -20,7 +21,7 @@ export default defineConfig({
// Match the prior Rollup build: bundle nothing third-party. Externalize every
// bare import (deps, peers, and node built-ins like `crypto`); bundle only the
// package's own relative/aliased modules.
neverBundle: (id) => !id.startsWith('.') && !id.startsWith('/') && !id.startsWith('src/'),
neverBundle: (id) => !id.startsWith('.') && !path.isAbsolute(id) && !id.startsWith('src/'),
onlyBundle: false,
},
plugins: [

View File

@@ -1,3 +1,4 @@
import path from 'node:path';
import { defineConfig } from 'tsdown';
export default defineConfig({
@@ -16,7 +17,7 @@ export default defineConfig({
!id.startsWith('dotenv/') &&
!id.startsWith('.') &&
!id.startsWith('~') &&
!id.startsWith('/'),
!path.isAbsolute(id),
// dotenv is bundled on purpose, so silence the "detected dependencies in bundle" hint.
onlyBundle: false,
},