Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPA provider (vite) #1257

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
test-plan:
name: Test Suite
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -118,6 +119,7 @@ jobs:
name: Docker Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.test-plan.outputs.matrix)}}
if: "!contains(github.event.head_commit.message, '(cargo-release)')"
steps:
Expand Down
55 changes: 38 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions docs/pages/docs/providers/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,23 @@ Corepack will only be used on Node 16 and above.
## Bun Support

We support Bun, but due to Bun being in alpha, it is unstable and very experimental.

## SPA Application Support

If we detect your application is using [Vite](https://vite.dev) and doesn't have a server, we will automatically compile your app and run it using [Caddy](https://caddyserver.com/)

If you wish to turn off Caddy, you can set the environment variable `NIXPACKS_SPA_CADDY` to `false`.

If you have an application that doesn't pass the requirements for automatically using [Caddy](https://caddyserver.com/), set the `NIXPACKS_SPA_OUT_DIR` variable to the out directory of your application.

### Caddy requirements

If your package.json has `vite` any of the following dependencies:

- `react`
- `vue`
- `svelte` (but not `@sveltejs/kit`)
- `preact`
- `lit`
- `solid-js`
- `@builder.io/qwik`
24 changes: 24 additions & 0 deletions examples/node-vite-lit-ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
16 changes: 16 additions & 0 deletions examples/node-vite-lit-ts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Lit + TS</title>
<link rel="stylesheet" href="./src/index.css" />
<script type="module" src="/src/my-element.ts"></script>
</head>
<body>
<my-element>
<h1>Vite + Lit</h1>
</my-element>
</body>
</html>
18 changes: 18 additions & 0 deletions examples/node-vite-lit-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "vite-lit-ts-starter",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"lit": "^3.2.1"
},
"devDependencies": {
"typescript": "~5.7.2",
"vite": "^6.0.7"
}
}
1 change: 1 addition & 0 deletions examples/node-vite-lit-ts/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/node-vite-lit-ts/src/assets/lit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions examples/node-vite-lit-ts/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}

body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}

@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
}
Loading
Loading