Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

fix(sveltekit): specify better output location #380

Merged
merged 1 commit into from
Aug 18, 2021

Conversation

benmccann
Copy link
Contributor

I don't know why it says static. That's an input directory where static assets are located and we shouldn't put output there

@erezrokah erezrokah added the type: bug code to address defects in shipped code label Aug 17, 2021
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

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

Hi @benmccann, can you point me to the relevant docs that show the location of the build directory?
I tried running a build locally and it builds to .svelte-kit/build, but I might have an older version.

Also, should we add staticAssetsDirectory with a value of static?
See

"staticAssetsDirectory": "public",

@benmccann
Copy link
Contributor Author

I've updated this PR to set staticAssetsDirectory

SvelteKit's adapter-netlify requires the build directory be set in netlify.toml and then reads that file to put the output in the specified location, so it can be any location. By default today the docs recommend:

[build]
  command = "npm run build"
  publish = "build/publish/"
  functions = "build/functions/"

However, SvelteKit is currently not really compatible with the Netlify CLI and we're considering a PR to change that which would require functions to be written under .netlify and so at that point we don't need to two sub-directories under build

@erezrokah
Copy link
Contributor

erezrokah commented Aug 17, 2021

Hi @benmccann, are all SvelteKit's expected to be using the adapter?

I wonder if a more flexible approach would be to use a Netlify Build Plugin?
We do it with Next.js and Gatsby. That will allow you to have much better integration with the CLI and build process.

For example, the Next.js plugin writes to an internal functions directory:
https://github.com/netlify/netlify-plugin-nextjs/blob/92e099015ce4d95c2817d95d35d0b828ee463be4/index.js#L124.

You can open an issue with your requirements on the CLI/Build repo and we can discuss more if that makes sense.

@benmccann
Copy link
Contributor Author

The SvelteKit adapter is being updated to write to the internal functions directory. It would be nice if that directory were documented though. Right now we're having to rely on undocumented behavior and insights gleamed off how Gatsby and other tools work

I'm not that familiar with Netlify and the build plugins and whether they might be helpful, but I think it'd be hard to use SvelteKit without any adapter

@erezrokah
Copy link
Contributor

Hi @benmccann, after looking at sveltejs/kit#2113, I believe we can move forward with this to unblock.

It would be nice if that directory were documented though. Right now we're having to rely on undocumented behavior and insights gleamed off how Gatsby and other tools work

Very good point @benmccann, and we're planning to document those. We've been using them internally so we can iterate on the API.

I'm not that familiar with Netlify and the build plugins and whether they might be helpful, but I think it'd be hard to use SvelteKit without any adapter

Thanks, that make sense. I think we can move forward with the PR.

@erezrokah erezrokah merged commit 9b9acea into netlify:main Aug 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants