Repository with Package.swift and package.json

I have a project with the following ssetup:


Note that there’s a Package.swift in the website directory that contains a Gatsby website. The reason being is that without that file, Xcode will include the node_modules directory in the Xcode project generated for the package, and because of that, Xcode is very slow.

My website on Netlify is set up to build from website/. Netlify detects that there’s a package.json and therefore it installs the dependencies using Yarn, and it does the same with Swift. However, it goes beyond that and it runs the swift build command, ignoring the command that I specified it should use for building the website:

  base = "website/"
  publish = "public/"
  command = "yarn build"

I don’t expect Netlify to run swift build. However it does, and that causes the deployment to fail.

I haven’t used Xcode, so, I’m not sure if this will work. But, maybe, you can add Package.swift to .gitignore and thus, it won’t get uploaded to your Git repo and won’t be used by Netlify. Then the rest should work normally, I guess.

Yup - like @hrishikesh said, we do “infer” that you need to run a swift build if you have that file. More details about that behavior here:

1 Like