Skip to content

feat: include @netlify/vite-plugin for platform emulation in dev#650

Open
serhalp wants to merge 3 commits intomainfrom
serhalp/auto-include-netlify-plugin
Open

feat: include @netlify/vite-plugin for platform emulation in dev#650
serhalp wants to merge 3 commits intomainfrom
serhalp/auto-include-netlify-plugin

Conversation

@serhalp
Copy link
Copy Markdown
Member

@serhalp serhalp commented Mar 13, 2026

Description

@netlify/vite-plugin-react-router now loads @netlify/vite-plugin automatically, providing seamless out-of-the-box local Netlify platform emulation in react-router dev.

(We do this already with @netlify/vite-plugin-tanstack-start and @astrojs/netlify.)

Related Tickets & Documents

N/A

QA Instructions, Screenshots, Recordings

Pull down one of the demos or fixture and try npm run dev.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 13, 2026

Deploy Preview for remix-edge ready!

Name Link
🔨 Latest commit b0b6431
🔍 Latest deploy log https://app.netlify.com/projects/remix-edge/deploys/69b46c9356fa7d0008148393
😎 Deploy Preview https://deploy-preview-650--remix-edge.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 13, 2026

Deploy Preview for remix-serverless ready!

Name Link
🔨 Latest commit b0b6431
🔍 Latest deploy log https://app.netlify.com/projects/remix-serverless/deploys/69b46c935f5f360008d4a5eb
😎 Deploy Preview https://deploy-preview-650--remix-serverless.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Mar 13, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

This pull request consolidates Netlify Vite plugin management within the vite-plugin-react-router package. The netlifyPlugin export function signature is modified to return an array of plugins instead of a single plugin, automatically including the Netlify Vite plugin in the array. A runtime dependency on @netlify/vite-plugin is added to the package. Documentation is updated to reflect automatic plugin inclusion rather than requiring manual installation and configuration. The test fixture vite.config.ts is simplified by removing explicit Netlify plugin references since they are now handled internally.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: automatically including @netlify/vite-plugin for platform emulation in development, which is the core objective reflected across all modified files.
Description check ✅ Passed The pull request description clearly explains the feature: automatically loading @netlify/vite-plugin to provide seamless local Netlify platform emulation in react-router dev, with references to similar implementations in other packages.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch serhalp/auto-include-netlify-plugin
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Comment thread packages/vite-plugin-react-router/README.md
pieh
pieh previously approved these changes Mar 13, 2026
@serhalp serhalp marked this pull request as ready for review March 13, 2026 19:59
@serhalp serhalp requested a review from a team as a code owner March 13, 2026 19:59
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/vite-plugin-react-router/src/plugin.ts (1)

327-328: Verify plugin ordering is intentional.

The React Router plugin is placed before the Netlify Vite plugin. This ordering means React Router-specific hooks (like config, resolveId, configResolved, etc.) will run before Netlify's general hooks for the same lifecycle events. Confirm this is the intended behavior for proper interoperability.

Consider adding a brief comment explaining the plugin ordering rationale:

📝 Suggested comment
+  // React Router plugin must run first to configure SSR build settings before Netlify's general plugin
   return [reactRouterPlugin, ...netlifyVitePlugin()]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vite-plugin-react-router/src/plugin.ts` around lines 327 - 328, The
plugin array returns reactRouterPlugin before netlifyVitePlugin which causes
React Router hooks (config, resolveId, configResolved, etc.) to run before
Netlify's hooks; confirm this ordering is intentional and, if so, add a short
comment above the return explaining the rationale (why reactRouterPlugin must
run first and any potential implications), or if not intentional swap the order
so netlifyVitePlugin runs first; reference the return statement that constructs
[reactRouterPlugin, ...netlifyVitePlugin()] and the plugin identifiers
reactRouterPlugin and netlifyVitePlugin when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/vite-plugin-react-router/src/plugin.ts`:
- Around line 327-328: The plugin array returns reactRouterPlugin before
netlifyVitePlugin which causes React Router hooks (config, resolveId,
configResolved, etc.) to run before Netlify's hooks; confirm this ordering is
intentional and, if so, add a short comment above the return explaining the
rationale (why reactRouterPlugin must run first and any potential implications),
or if not intentional swap the order so netlifyVitePlugin runs first; reference
the return statement that constructs [reactRouterPlugin, ...netlifyVitePlugin()]
and the plugin identifiers reactRouterPlugin and netlifyVitePlugin when making
the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5fef7ae8-8dac-4c3b-abfb-c45cbae4a1b7

📥 Commits

Reviewing files that changed from the base of the PR and between c8f93a2 and b0b6431.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • packages/vite-plugin-react-router/README.md
  • packages/vite-plugin-react-router/package.json
  • packages/vite-plugin-react-router/src/plugin.ts
  • tests/e2e/fixtures/hydrogen-react-router-site/package.json
  • tests/e2e/fixtures/hydrogen-react-router-site/vite.config.ts
💤 Files with no reviewable changes (1)
  • tests/e2e/fixtures/hydrogen-react-router-site/package.json

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

Labels

type: feature code contributing to the implementation of a feature and/or user facing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants