Skip to content

feat: inject SPA config in Frameworks API - #28

Open
hrishikesh-k wants to merge 4 commits into
mainfrom
hk/vite-spa
Open

feat: inject SPA config in Frameworks API#28
hrishikesh-k wants to merge 4 commits into
mainfrom
hk/vite-spa

Conversation

@hrishikesh-k

@hrishikesh-k hrishikesh-k commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Update: Property changed to spa_fallback instead of build.spa.


Follow-up of: netlify/build#7141

When appType === 'spa', the Vite plugin will now auto-inject:

{
  "build": {
    "spa": true
  }
}

in .netlify/v1/config.json. Then, @netlify/build and @netlify/config changes in the above linked PR will handle adding the rewrite.

@hrishikesh-k
hrishikesh-k requested a review from a team as a code owner July 23, 2026 11:54
@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for angular-runtime-demo ready!

Name Link
🔨 Latest commit fc1f3f8
🔍 Latest deploy log https://app.netlify.com/projects/angular-runtime-demo/deploys/6a62044c91c2c40008636d49
😎 Deploy Preview https://deploy-preview-28--angular-runtime-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@coderabbitai

coderabbitai Bot commented Jul 23, 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: c790d341-aec4-47da-8e88-9770c91764ba

📥 Commits

Reviewing files that changed from the base of the PR and between c933fa7 and 2f8a64a.

📒 Files selected for processing (4)
  • .prettierignore
  • packages/vite-plugin/src/lib/build.test.ts
  • packages/vite-plugin/src/lib/build.ts
  • packages/vite-plugin/src/main.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .prettierignore
  • packages/vite-plugin/src/main.ts
  • packages/vite-plugin/src/lib/build.ts
  • packages/vite-plugin/src/lib/build.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • SPA builds now automatically generate Netlify configuration with SPA fallback support.
    • Existing Netlify configuration settings are preserved when fallback support is added.
  • Bug Fixes

    • Non-SPA builds no longer create unnecessary Netlify configuration files.
  • Tests

    • Added coverage for SPA, non-SPA, and existing-configuration scenarios.
  • Chores

    • Updated formatting rules to ignore generated Nuxt files.

Walkthrough

The Vite plugin now generates .netlify/v1/config.json for SPA client builds. It preserves existing Netlify configuration and adds spa_fallback: true. Non-SPA builds do not create the file. Tests cover these behaviors. Prettier now ignores .nuxt.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: inject SPA config in Frameworks API' accurately describes the main change—adding automatic SPA configuration injection to the Vite plugin.
Description check ✅ Passed The description explains the SPA configuration injection feature, references a related PR, and describes the mechanism and expected behavior when appType is 'spa'.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hk/vite-spa

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.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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/src/main.ts (1)

144-144: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the public netlify() wiring.

The new tests invoke createSpaConfigPlugin() directly, so they would still pass if netlify() stopped returning this plugin. Add an integration assertion through netlify() to protect this public entry point.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/vite-plugin/src/main.ts` at line 144, Add integration coverage for
the public netlify() entry point that verifies its returned plugin wiring
includes the createSpaConfigPlugin() behavior. Keep the existing direct
createSpaConfigPlugin() tests, but exercise the behavior through netlify() so
removing that plugin from netlify() causes the test to fail.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/vite-plugin/src/main.ts`:
- Line 144: Add integration coverage for the public netlify() entry point that
verifies its returned plugin wiring includes the createSpaConfigPlugin()
behavior. Keep the existing direct createSpaConfigPlugin() tests, but exercise
the behavior through netlify() so removing that plugin from netlify() causes the
test to fail.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: efe758f3-3740-48b0-bf54-c51e0bbff69c

📥 Commits

Reviewing files that changed from the base of the PR and between cbec926 and 813c340.

📒 Files selected for processing (5)
  • .prettierignore
  • packages/angular-runtime/demo.test.mjs
  • packages/vite-plugin/src/lib/build.test.ts
  • packages/vite-plugin/src/lib/build.ts
  • packages/vite-plugin/src/main.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)
💤 Files with no reviewable changes (1)
  • packages/angular-runtime/demo.test.mjs

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for angular-runtime-demo ready!

Name Link
🔨 Latest commit 2f8a64a
🔍 Latest deploy log https://app.netlify.com/projects/angular-runtime-demo/deploys/6a7219abdcd0370008b122a8
😎 Deploy Preview https://deploy-preview-28--angular-runtime-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

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