Configure SvelteKit for Netlify
nickytonline opened this issue · 6 comments
Describe the bug A clear and concise description of what the bug is.
The netlify.toml is no longer required since the fix in netlify/framework-info#818.
We can safely delete it for now. If we need to add things to the config later, like Netlify Functions or Netlify Edge Functions, we can always bring back a netlify.toml file
To Reproduce Steps to reproduce the behavior:
N/A
Expected behavior A clear and concise description of what you expected to
happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context Add any other context about the problem here.
I'm happy to take this one!
Assigned it to you @gentlegiantdev!
Small update @gentlegiantdev
We still need the netlify.toml
file, but just the build
section, i.e.
[build]
command = "npm run build"
publish = "dist"
Also, when I converted the project to SvelteKit, I didn't configure it properly for deployments on Netlify. The svelte.config.js
file should look like this.
import adapter from '@sveltejs/adapter-netlify';
export default {
kit: {
// default options are shown
adapter: adapter({
// if true, will create a Netlify Edge Function rather
// than using standard Node-based functions
edge: true,
// if true, will split your app into multiple functions
// instead of creating a single one for the entire app.
// if `edge` is true, this option cannot be used
split: false
})
}
};
and the last thing to do is add the build/
folder to the end of the .gitignore
file
Let me know if anything is unclear or you need a hand with something.
Not a problem. A few clarifying questions:
Do you also need functions = "netlify/functions"
- line 4 in the original netlify.toml?
What about import preprocess from 'svelte-preprocess';
- line 2 in original svelte.config.js?
Everything else in the .gitignore has comments - what would be a suitable one for build/*
? Should I delete build/Release
since that is covered by build/*
?
Great questions @gentlegiantdev!
Do you also need functions = "netlify/functions" - line 4 in the original netlify.toml?
It's safe to remove.
What about import preprocess from 'svelte-preprocess'; - line 2 in original svelte.config.js?
It's safe to remove for now. If we end up needing it later on, we can always bring it back.
Everything else in the .gitignore has comments - what would be a suitable one for build/? Should I delete build/Release since that is covered by build/?
Good catch on build/Release
. You can remove it. This file is generated with a bunch of defaults for all Node.js projects, which is why it was there.
For the comment for build/
, you can add a comment above that and the .svelte-kit/
entry and say something like # SvelteKit build artifacts
, i.e.
# SvelteKit build artifacts
.svelte-kit/
build/
Cool, just pushed those changes! I'm logging off for the night so I will check in the morning.