Skip to content

Conversation

@Milo123459
Copy link
Contributor

@Milo123459 Milo123459 commented Jan 10, 2025

  • vite spa provider
  • also use out directory if specified in the build command
  • vite spa provider

This PR introduces a Vite SPA provider which will automatically run supported applications with Caddy.

It can be configured via NIXPACKS_SPA_CADDY to turn off Caddy, or if you want to turn Caddy on for an application that doesn't automatically get detected, you can specify a build directory with the NIXPACKS_SPA_OUT_DIR variable.

Detection

Vite is detected by:

  • vite dependency
  • vite.config.js or vite.config.ts
  • build script contains vite build

Output directory:

  • if outDir is in vite.config.js/ts
  • if --outDir is in the build script

Caddy:

  • These dependencies are detected:
    • react
    • vue
    • svelte (but not @sveltejs/kit)
    • preact
    • lit
    • solid-js
    • @builder.io/qwik
  • Tests are added/updated if needed
  • Docs are updated if needed

@Milo123459 Milo123459 added the release/minor Author minor release label Jan 10, 2025
@Milo123459
Copy link
Contributor Author

no idea why the lunatic one is failing

@Milo123459 Milo123459 requested a review from coffee-cup January 14, 2025 16:17
Copy link
Contributor

@coffee-cup coffee-cup left a comment

Choose a reason for hiding this comment

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

Nice work! This will definitely make it easier for people coming from Vite apps.

Do you know how this will interact with users who have a custom nixpacks.toml and Caddy file for deploying static sites already?

@Milo123459
Copy link
Contributor Author

I'm not sure, but the Caddyfile wouldn't overwrite the users. And im pretty sure it would just use what's in nixpacks.toml as opposed to what the SPA provider generates.

@Milo123459 Milo123459 requested a review from coffee-cup January 15, 2025 19:05
@Milo123459 Milo123459 requested a review from coffee-cup January 16, 2025 10:57
Copy link
Contributor

@coffee-cup coffee-cup left a comment

Choose a reason for hiding this comment

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

Looks good! I've tested on various repos and it works well 🎉

@coffee-cup coffee-cup merged commit 03c5c82 into main Jan 16, 2025
103 checks passed
@coffee-cup coffee-cup deleted the milo/spa-provider branch January 16, 2025 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/minor Author minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants