Skip to content

feat: inject SPA config in Frameworks API#28

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

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

Conversation

@hrishikesh-k

Copy link
Copy Markdown
Contributor

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

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • SPA builds now automatically generate or update Netlify configuration with build.spa: true.
    • Existing Netlify build settings are preserved when SPA configuration is added.
  • Bug Fixes

    • Non-SPA builds no longer generate SPA-specific Netlify configuration.
  • Tests

    • Added coverage for default SPA configuration, existing configuration merging, and non-SPA builds.

Walkthrough

The Vite plugin now adds a build-time SPA configuration plugin that reads .netlify/v1/config.json, preserves existing fields, and writes build.spa: true for SPA applications. The plugin is always included by netlify(), while the existing build plugin remains conditional. Tests cover new, merged, and non-SPA configurations. .nuxt is added to .prettierignore.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: injecting SPA config into the Frameworks API.
Description check ✅ Passed The description matches the changeset by explaining the new SPA config injection and its intended downstream effect.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 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

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