Skip to content

feat(vite): add root option to override .nuxt-ui directory location#6595

Open
benjamincanac wants to merge 1 commit into
v4from
feat/vite-root-option
Open

feat(vite): add root option to override .nuxt-ui directory location#6595
benjamincanac wants to merge 1 commit into
v4from
feat/vite-root-option

Conversation

@benjamincanac

Copy link
Copy Markdown
Member

Description

Adds a root option to the @nuxt/ui/vite plugin to override the directory where the .nuxt-ui directory (generated theme templates) is created.

By default the plugin uses Vite's config.root. In setups like electron-vite the renderer's root points to a sub-directory (e.g. src/renderer), so the templates land in src/renderer/node_modules/.nuxt-ui where Tailwind doesn't scan them, causing theme classes like bg-default, ring-default and divide-default to be missing.

// electron.vite.config.ts
export default defineConfig({
  renderer: {
    root: 'src/renderer',
    plugins: [vue(), ui({ root: __dirname })]
  }
})

Closes #6589

@github-actions github-actions Bot added the v4 #4488 label Jun 15, 2026
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af5e5c13-c848-4968-9e8a-2591d0275896

📥 Commits

Reviewing files that changed from the base of the PR and between f99778e and 327a2c4.

📒 Files selected for processing (3)
  • docs/content/docs/1.getting-started/2.installation/2.vue.md
  • src/plugins/templates.ts
  • src/unplugin.ts

📝 Walkthrough

Walkthrough

A new optional root configuration field is added to NuxtUIOptions in src/unplugin.ts. In src/plugins/templates.ts, TemplatePlugin now resolves the template write path using options.root first, then config.root, then '.' as a final fallback. Documentation for the new option is added to the Vue installation guide, including an electron-vite example showing ui({ root: __dirname }) to ensure the generated .nuxt-ui directory lands in a Tailwind-scanned node_modules.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly describes the main feature: adding a root option to override the .nuxt-ui directory location in the Vite plugin.
Description check ✅ Passed Description is well-related to the changeset, explaining the problem context, solution, and usage example with a reference to the related issue.
Linked Issues check ✅ Passed All code changes align with #6589 requirements: adds root option to NuxtUIOptions, uses it in template generation, and documentation explains the electron-vite use case.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the root option feature: option declaration, implementation in template plugin, and documentation examples.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/vite-root-option

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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.

@pkg-pr-new

pkg-pr-new Bot commented Jun 15, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/ui@6595

commit: 327a2c4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Root parameter in NuxtUi plugin for config position of .nuxt-ui directory

1 participant