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

Configure SvelteKit for Netlify #45

Closed
nickytonline opened this issue Oct 13, 2022 · 6 comments · Fixed by #46
Closed

Configure SvelteKit for Netlify #45

nickytonline opened this issue Oct 13, 2022 · 6 comments · Fixed by #46
Assignees
Labels
dx Anything related to Developer Experience good first issue Good for newcomers

Comments

@nickytonline
Copy link
Owner

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.

@nickytonline nickytonline added good first issue Good for newcomers dx Anything related to Developer Experience labels Oct 13, 2022
@gentlegiantdev
Copy link
Contributor

I'm happy to take this one!

@nickytonline
Copy link
Owner Author

Assigned it to you @gentlegiantdev!

@nickytonline
Copy link
Owner Author

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.

@gentlegiantdev
Copy link
Contributor

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/*?

@nickytonline
Copy link
Owner Author

nickytonline commented Oct 14, 2022

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/

@nickytonline nickytonline changed the title Remove netlify.toml to use Netlify default SvelteKit configuration Configure SvelteKit for Netlify Oct 14, 2022
@gentlegiantdev
Copy link
Contributor

Cool, just pushed those changes! I'm logging off for the night so I will check in the morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx Anything related to Developer Experience good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants