Skip to content

refactor(vite)!: early init nitro#3675

Closed
pi0 wants to merge 3 commits into
mainfrom
feat/nitro-vite-plugins
Closed

refactor(vite)!: early init nitro#3675
pi0 wants to merge 3 commits into
mainfrom
feat/nitro-vite-plugins

Conversation

@pi0
Copy link
Copy Markdown
Member

@pi0 pi0 commented Oct 23, 2025

Context

Nitro Vite plugin needs to inject other rollup plugin hooks in dev and to resolve those plugins it needs to instantiate based on env (dev|build + root + user config are required to init)

Currently, we do it with a very hacky workaround to manually call rollup plugin hooks which is broken in many cases as we don't chain hooks nor respect order.

New workaround

We could infer userConfig somehow from global (NODE_ENV and process.argv) and root dir from last arg + cwd.

We cannot anymore also access to user config from top level...

Alternatives

Ideally it would be great if vite could allow exending plugins with config hook (here) -- giving the responsibility to plugin authors to only inject valid/resolved plugins in there with intended order.

One other alternative would be that vite supporting callable functions as plugins input and call/instnatiate them itself using params similar to filter

A 3rd alternative would be keeping current solution but an improved dynamicRollupPlugins() util that adds hooks with respect of order and chaining (for dev).

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
nitro.build Ready Ready Preview Comment Oct 23, 2025 9:55pm

@pi0 pi0 marked this pull request as draft October 23, 2025 21:42
@pi0 pi0 requested a review from hi-ogawa October 23, 2025 21:45
@pi0
Copy link
Copy Markdown
Member Author

pi0 commented Oct 24, 2025

#3676

@pi0 pi0 closed this Oct 24, 2025
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