Skip to content

Conversation

@danielroe
Copy link
Member

🔗 Linked issue

resolves #32953

📚 Description

this respects nuxt aliases set in imports.dirs

@bolt-new-by-stackblitz
Copy link

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 27, 2025

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@33334

nuxt

npm i https://pkg.pr.new/nuxt@33334

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@33334

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@33334

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@33334

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@33334

commit: 6a4017f

@coderabbitai
Copy link

coderabbitai bot commented Sep 27, 2025

Walkthrough

Adjusts resolution of composable directories in packages/nuxt/src/imports/module.ts. For each layer, entries from imports.dirs are now passed through the alias-aware resolver (resolveAlias) before being combined with the layer’s srcDir. This changes the computed composablesDirs paths used for watching, scanning, and import generation. No other logic paths or public APIs are modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly identifies the main fix by indicating that nuxt’s imports.dirs entries will now have aliases resolved. It matches the change in the pull request which introduces alias-aware resolution instead of raw directory paths. The phrasing is concise, clear, and follows conventional commit style.
Linked Issues Check ✅ Passed The change implements alias-aware resolution for imports.dirs, which addresses the nested wildcard import issue described in issue #32953 by correctly resolving patterns like '~/composables/**'. This directly fulfils the coding requirement to restore nested auto-import functionality under nuxt v4. There are no deviations from the issue’s objectives at the code level.
Out of Scope Changes Check ✅ Passed The pull request is focused solely on adjusting the resolution of composable directories and does not introduce unrelated modifications or features. All changes are directly tied to alias handling in imports.dirs. No extraneous code alterations are present.
Description Check ✅ Passed The description refers to the linked issue and clearly mentions that imports.dirs will now respect nuxt aliases, which directly relates to the modifications in alias resolution. It adequately captures the essence of the pull request despite its brevity. This satisfies the lenient requirement for relevance.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/import-aliases

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d63479 and 6a4017f.

📒 Files selected for processing (1)
  • packages/nuxt/src/imports/module.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nuxt/src/imports/module.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: GalacticHypernova
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.
📚 Learning: 2024-11-05T15:22:54.759Z
Learnt from: GalacticHypernova
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.

Applied to files:

  • packages/nuxt/src/imports/module.ts
🧬 Code graph analysis (1)
packages/nuxt/src/imports/module.ts (2)
packages/kit/src/resolve.ts (1)
  • resolveAlias (91-94)
packages/kit/src/index.ts (1)
  • resolveAlias (32-32)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: code
  • GitHub Check: build
🔇 Additional comments (1)
packages/nuxt/src/imports/module.ts (1)

67-70: Alias resolution fix verified.

Resolving each configured dir through resolveAlias(..., nuxt.options.alias) before joining with the layer’s srcDir avoids the previous ~/ literal leakage, so patterns like ~/composables/** now point to the actual directory tree for scanning.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 27, 2025

CodSpeed Performance Report

Merging #33334 will not alter performance

Comparing fix/import-aliases (6a4017f) with main (3e4a999)1

Summary

✅ 10 untouched

Footnotes

  1. No successful run was found on main (2d63479) during the generation of this report, so 3e4a999 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@danielroe danielroe merged commit a52ce9a into main Sep 27, 2025
84 of 85 checks passed
@danielroe danielroe deleted the fix/import-aliases branch September 27, 2025 11:52
@github-actions github-actions bot mentioned this pull request Sep 27, 2025
danielroe added a commit that referenced this pull request Oct 6, 2025
@github-actions github-actions bot mentioned this pull request Oct 6, 2025
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.

[v4] imports.dirs nested wildcard does not work

2 participants