Skip to content

fix(kit): avoid falling back to normalized path for loadNuxtModuleInstance#27507

Merged
danielroe merged 2 commits intomainfrom
fix/module-internal-resolve
Jun 10, 2024
Merged

fix(kit): avoid falling back to normalized path for loadNuxtModuleInstance#27507
danielroe merged 2 commits intomainfrom
fix/module-internal-resolve

Conversation

@pi0
Copy link
Copy Markdown
Member

@pi0 pi0 commented Jun 10, 2024

Discovered while investigating #27479

When installing nuxt modules, we use kit.resolvePath utility first to resolve aliases, etc.

If they cannot be resolved for any reason (this way happening in unit tests silently), the util returns the normalized value (which is ${cwd}/path).

Returned value can be something like /source/to/nuxt/@nuxt/telemetry which is obviously invalid and was being passed to the import() which was obviously always failing even when the module is a valid ESM module and then fallback to jiti (via kit.requireModule)

Jiti's ESM resolver (bundled mlly) was somehow (yet i don't know how) fixing this situation but with latest bundled ESM resolve algorithm, it won't be effective and revealed this..

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pi0 pi0 requested a review from danielroe June 10, 2024 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants