Skip to content

Commit 41ed8ee

Browse files
committed
build: Use static adapter and deploy build output
- Replace adapter-auto with @sveltejs/adapter-static and set fallback to '404.html' in svelte.config.js - Add @sveltejs/adapter-static to package.json and package-lock.json - Update GitHub Actions to upload 'build' artifact instead of 'dist' - Enable prerendering and SSR via src/routes/+layout.js
1 parent 3297781 commit 41ed8ee

5 files changed

Lines changed: 25 additions & 8 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Upload artifact
3939
uses: actions/upload-pages-artifact@v3
4040
with:
41-
path: "dist"
41+
path: "build"
4242
- name: Deploy to GitHub Pages
4343
id: deployment
4444
uses: actions/deploy-pages@v4

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"devDependencies": {
1515
"@sveltejs/adapter-auto": "^7.0.0",
16+
"@sveltejs/adapter-static": "^3.0.10",
1617
"@sveltejs/kit": "^2.50.2",
1718
"@sveltejs/vite-plugin-svelte": "^6.2.4",
1819
"@tailwindcss/vite": "^4.2.1",

src/routes/+layout.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
export const prerender = true;
3+
export const ssr = true;

svelte.config.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
import adapter from '@sveltejs/adapter-auto';
1+
import adapter from "@sveltejs/adapter-static";
22

33
/** @type {import('@sveltejs/kit').Config} */
44
const config = {
5-
kit: {
6-
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
7-
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
8-
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
9-
adapter: adapter()
10-
}
5+
kit: {
6+
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
7+
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
8+
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
9+
adapter: adapter({
10+
fallback: '404.html'
11+
})
12+
},
1113
};
1214

1315
export default config;

0 commit comments

Comments
 (0)