Skip to content

🐛 fix: resolve dayjs plugin ESM imports in data-provider (0.8.507)#13851

Merged
danny-avila merged 1 commit into
devfrom
fix/data-provider-dayjs-esm
Jun 19, 2026
Merged

🐛 fix: resolve dayjs plugin ESM imports in data-provider (0.8.507)#13851
danny-avila merged 1 commit into
devfrom
fix/data-provider-dayjs-esm

Conversation

@danny-avila

Copy link
Copy Markdown
Owner

Summary

librechat-data-provider@0.8.506 is a broken ESM publish. parsers.ts imports the dayjs timezone plugins without a file extension:

import utc from 'dayjs/plugin/utc';
import timezonePlugin from 'dayjs/plugin/timezone';

The tsdown build externalizes every bare import, so it emits those specifiers verbatim into dist/index.mjs. dayjs@1.11 ships no exports map, so under strict Node ESM the extensionless subpaths fail:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/dayjs/plugin/utc'
  imported from .../librechat-data-provider/dist/index.mjs
Did you mean to import "dayjs/plugin/utc.js"?

This breaks any strict-ESM consumer that transitively imports data-provider — and @librechat/data-schemas, which re-exports it. It surfaced as 9 failing vitest suites in the admin-panel, which had to pin data-provider to exactly 0.8.505 to work around it.

Fix

Add the .js extension so the externalized imports resolve under strict Node ESM. With moduleResolution: bundler the types still resolve from the plugin .d.ts, and the CJS build (require('dayjs/plugin/utc.js')) is unaffected. Version bumped to 0.8.507 to supersede the broken 0.8.506.

0.8.505 was fine only because it predates the timezone feature that introduced these plugin imports.

Verification

  • npm run build:data-provider — clean
  • node --input-type=module -e "import('./dist/index.mjs')" — resolves, 428 exports (was ERR_MODULE_NOT_FOUND)
  • parsers specs — 50/50 pass
  • eslint + sort-imports:check — clean

`parsers.ts` imported `dayjs/plugin/utc` and `dayjs/plugin/timezone`
without a file extension. The tsdown build externalizes all bare imports,
so it emitted those specifiers verbatim into `dist/index.mjs`. dayjs@1.11
ships no `exports` map, so under strict Node ESM the extensionless
subpaths fail with ERR_MODULE_NOT_FOUND ("Did you mean to import
'dayjs/plugin/utc.js'?"), breaking every strict-ESM consumer that
transitively imports data-provider (and data-schemas, which re-exports
it) — e.g. vitest suites in downstream apps.

Add the `.js` extension so the externalized imports resolve. With
moduleResolution: bundler the types still resolve from the plugin
`.d.ts`. Bump to 0.8.507 to supersede the broken 0.8.506 publish.

Verified: build clean, `dist/index.mjs` imports under strict Node ESM
(node --input-type=module), parsers specs 50/50.
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: f1e6ae60c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila merged commit 36ae268 into dev Jun 19, 2026
30 checks passed
@danny-avila
danny-avila deleted the fix/data-provider-dayjs-esm branch June 19, 2026 15:11
fuuuzzy pushed a commit to fuuuzzy/LibreChat that referenced this pull request Jul 7, 2026
…#13851)

`parsers.ts` imported `dayjs/plugin/utc` and `dayjs/plugin/timezone`
without a file extension. The tsdown build externalizes all bare imports,
so it emitted those specifiers verbatim into `dist/index.mjs`. dayjs@1.11
ships no `exports` map, so under strict Node ESM the extensionless
subpaths fail with ERR_MODULE_NOT_FOUND ("Did you mean to import
'dayjs/plugin/utc.js'?"), breaking every strict-ESM consumer that
transitively imports data-provider (and data-schemas, which re-exports
it) — e.g. vitest suites in downstream apps.

Add the `.js` extension so the externalized imports resolve. With
moduleResolution: bundler the types still resolve from the plugin
`.d.ts`. Bump to 0.8.507 to supersede the broken 0.8.506 publish.

Verified: build clean, `dist/index.mjs` imports under strict Node ESM
(node --input-type=module), parsers specs 50/50.
ThomasVuNguyen pushed a commit to ThomasVuNguyen/LibreChat that referenced this pull request Jul 15, 2026
…#13851)

`parsers.ts` imported `dayjs/plugin/utc` and `dayjs/plugin/timezone`
without a file extension. The tsdown build externalizes all bare imports,
so it emitted those specifiers verbatim into `dist/index.mjs`. dayjs@1.11
ships no `exports` map, so under strict Node ESM the extensionless
subpaths fail with ERR_MODULE_NOT_FOUND ("Did you mean to import
'dayjs/plugin/utc.js'?"), breaking every strict-ESM consumer that
transitively imports data-provider (and data-schemas, which re-exports
it) — e.g. vitest suites in downstream apps.

Add the `.js` extension so the externalized imports resolve. With
moduleResolution: bundler the types still resolve from the plugin
`.d.ts`. Bump to 0.8.507 to supersede the broken 0.8.506 publish.

Verified: build clean, `dist/index.mjs` imports under strict Node ESM
(node --input-type=module), parsers specs 50/50.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant