Solved: Hosting on Amplify
Hey everyone! I'm dipping my toes into a fresh TS Start app for my company in a monorepo made up of TS Router apps, all on Vite. We host on Amplify and each app gets a different subdomain. All the other apps build into a
dist/ directory that Amplify knows to look for, and they all have an index.html file in the root which I imagine is the entrypoint for Amplify? TS Start builds an .output/ directory, which was my guess to point Amplify at, but I noticed that it doesn't have a root-level html file.
I saw in another thread that someone suggested setting server: { preset: 'aws-amplify' }, but I'm unclear where to do this because my vite.config.ts file throws type errors anywhere I drop it. Happy to provide code samples if helpful!
Has anyone here set up a monorepo with Amplify and made an app with Start? How'd you get everything hooked up?
Thanks!3 Replies
unwilling-turquoiseOP•3mo ago
Some further context: I'm not the one with Amplify permissions, so I've neither configured the previous apps nor would I be the one setting this up, I just need to make sure TS Start builds the proper output, and then relay the target directory and any other unique config to my team
metropolitan-bronze•3mo ago
That would be the target, you might also need the nitro.config.ts
unwilling-turquoiseOP•3mo ago
Update! I managed to find that the correct way to target Amplify is to have the following in my
vite.config.ts: defineConfig({ plugins: [ tanstackStart({ target: "aws-amplify"... and when I ran a build I got a new .amplify-hosting/ directory! Seems like that's the directory I should have my teammate point Amplify at
From your experience, is the built nitro.json file in there enough for me to point my team at and they'll have what they need to get it hosted?
Okay confirmed! We updated our amplify.yml file to use the .amplify-hosting/ directory and the build worked 🎉