Skip to content

fix(db): import db lib by file so the module loads without jiti - #941

Merged
atinux merged 1 commit into
nuxt-hub:mainfrom
onmax:fix/db-lib-file-import
Oct 23, 2026
Merged

atinux merged 1 commit into
nuxt-hub:mainfrom
onmax:fix/db-lib-file-import

Conversation

@onmax

@onmax onmax commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #940

dist/module.mjs imports the directory ./db/lib. Node can't load directory imports, so Nuxt falls back to jiti and, with compatibilityVersion: 5, prints NUXT_B8023.

 // dist/module.mjs
-import { ... } from './db/lib';
+import { ... } from '../dist/db/lib/index.mjs';

@nuxt/module-builder only rewrites ./lib/... imports to the built file, not bare ./lib, so setup.ts now imports ./lib/index. The old string externals only silenced unbuild's implicit-dependency warning. A regex does the same for the new path, like module-builder's /dist[\\/]runtime[\\/]/.

Repro: https://github.com/onmax/repros/tree/repro/nuxthub-940/nuxthub-940. pnpm verify fails with the packed main build and passes with this branch.

No test added: CI tests run against the dev:prepare stub, which loads through jiti either way.

@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown

@onmax is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxthub/core@941

commit: 9a6e806

Co-authored-by: onmax <maximogarciamtnez@gmail.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1696b-6477-758d-8bac-4b909ef4ac47
Co-authored-by: Sébastien Chopin <atinux@gmail.com>
@atinux
atinux force-pushed the fix/db-lib-file-import branch from 9a6e806 to 68a1557 Compare October 23, 2026 15:56
@atinux
atinux merged commit df74206 into nuxt-hub:main Oct 23, 2026
5 of 6 checks passed
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.

dist/module.mjs imports the directory ./db/lib, so Nuxt cannot load the module natively (NUXT_B8023 jiti fallback)

2 participants