kit icon indicating copy to clipboard operation
kit copied to clipboard

[Bug] Adapters don't run when using shared config package (monorepo)

Open WillsterJohnson opened this issue 2 years ago • 3 comments

Describe the bug

Hi! Me again, back with another oddity.

Config files in monorepos are often very similar if not identical across packages and apps in a monorepo.

For this reason, many of us choose to add a package which exports our configurations, which are then used and tweaked by our packages. This prevents accidental config issues, and makes it much easier to roll out a config change to all packages and apps.

Unfortunately, if you choose to do this with Vite's config, and you have a SvelteKit app consuming it, your app will not execute it's adapters. This is not fun, and it would be great if shared configs worked with adapted SvelteKit apps.

Reproduction

Here's a repo I made for this.

Apologies for using pnpm instead of npm, hopefully the effort I've put into making this easy to demonstrate will redeem that.

Did you try a different adapter?

Fair point, no. But I want to deploy to Vercel, so if the Vercel adapter doesn't work, then, as far as my use case goes, adapting doesn't work.

Logs

No response

System Info

# not necessarily relevant, but here they are regardless

  System:
    OS: Linux 6.2 Pop!_OS 22.04 LTS
    CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
    Memory: 4.82 GB / 15.34 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 19.8.1 - ~/.nvm/versions/node/v19.8.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v19.8.1/bin/yarn
    npm: 9.5.1 - ~/.nvm/versions/node/v19.8.1/bin/npm
  Browsers:
    Chrome: 112.0.5615.165
    Firefox: 112.0.1

Severity

serious, but I can work around it

Additional Information

serious, but I can work around it

The workaround is copy-pasting configs across however many SvelteKit apps your repo has. This isn't normally that many, but it does mean you have shared configs for your component libs and local configs for your apps, which is somehow more frustrating than having local configs for everything (maybe because "it's so close to perfect just do the thing dammit!"?).

The reproduction repo contains some additional information, as well as a handy ~~one~~24-liner to automatically clone, install, run, capture logs, and compare the working local config with the non-working shared config.

unfortunately I have no idea what causes this. Maybe SvelteKit ends up looking in the wrong place when trying to use adapters, maybe Vite provides incorrect context to the plugin, maybe there are monorepo-hating gremlins inside my computer. Wish I had more info than this.

WillsterJohnson avatar May 23 '23 20:05 WillsterJohnson

Not sure how useful this will be, but here's the Vercel build logs which notified me of this. The output is much the same as the shared config output in the demo repo, followed then by this;

Error: No Output Directory named "public" found after the Build completed. You can configure the Output Directory in your Project Settings.
Learn More: https://vercel.link/missing-public-directory
Deployment completed
STATIC_BUILD_NO_OUT_DIR: No Output Directory named "public" found after the Build completed. You can configure the Output Directory in your Project Settings.

In my deployment I use turbo to build, and the same shared config setup as is in the demo repo. pnpm also; it's just better.

WillsterJohnson avatar May 23 '23 20:05 WillsterJohnson

I am getting the same error and now unable to build on vercel. Whereas, I WAS able to do so about a week ago. Perhaps an 'upgraded' package is the culprit.

What is the workaround?

LarryEitel avatar Jun 22 '23 19:06 LarryEitel

For more details, see: https://discord.com/channels/457912077277855764/1121547244441710633

LarryEitel avatar Jun 23 '23 00:06 LarryEitel

as it's been a while, I've re-run the demo repo I provided after running pnpm update, the issue persists on the latest versions of all dependencies.

WillsterJohnson avatar Jun 28 '23 19:06 WillsterJohnson