Skip to content

Netlify adapter config sources #1604

@rsdavis

Description

@rsdavis

Is your feature request related to a problem? Please describe.
Yes. In a monorepo setup, it is common to put the frontend client code in its own directory. But, if you want to configure the base directory for Netlify, the netlify.toml file must go in the root directory. The problem is that the SvelteKit Netlify adapter looks for the config file in the base directory. Of course, its is not there, and an error is thrown "Missing a netlify.toml file."

Example directory structure where site/ is the base directory ...

backend/
site/
site/package.json
netlify.toml
# netlify.toml
[build]
  base      = "site/"
  command   = "npm run build"
  publish   = "build/"
  functions = "functions/"

Describe the solution you'd like
It would be nice to be able to feed these parameters into the adapter. So the config file would look something like ...

const config = {
    kit: {
        target: '#svelte',
        adapter: netlify({
           publish: "build",
           functions: "functions" 
       })
    }
};

I also imagine that there would be default values in the case when the parameters are not specified and the netlify.toml is not present. With the approach, the netlify.toml file can be kept at root level, and the adapter still gets the information that it needs without the file needing to present in the base directory.

How important is this feature to you?
This feature is not critical because you can get around this issue by setting the base directory in the Netlify UI and create a netlify.toml file in the base directory that supplies the parameters. But its is important because setting parameters via the UI is not versioned or easily reproducible. Committing the base path via config is essential for achieving infrastructure-as-code.

Additional context
I searched this issue and could not find it being discussed anywhere. My apologies if I am missing something. I am loving SvelteKit so far, excellent work, thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions