Skip to content

Commit 6a94aa6

Browse files
committed
feat: add inertia deployment guide
1 parent 00e1756 commit 6a94aa6

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/docs/frontend/inertia.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ response()->inertia('profile/update', [
322322

323323
That's all you have to do, inertia will automatically catch the errors in `useForm` and display them in the `InputError` component since we already set that up.
324324

325+
## Deploying Inertia Apps
326+
327+
While deployment is pretty much the same as deploying a regular Leaf app, you'll need to build your assets before deploying to production otherwise you'll have quite a broken app. Check out the [deployment guide](/learn/deployment/#deploying-vite-inertia-apps) for more information.
328+
325329
## Conclusion
326330

327331
Inertia is the perfect replacement for Blade views in Leaf MVC, and actually allows you build more powerful applications with the tons of available JavaScript libraries out there. It's a great way to build full-stack apps, supercharged by Leaf 💚

src/learn/deployment/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ Okay, now let’s get your app live! 🚀
4242
| [Heroku](/learn/deployment/heroku/) | Deploying a base Leaf project to Heroku using the Leaf CLI |
4343
| [Fly.io](/learn/deployment/flyio/) | Deploying a base Leaf application to Fly.io |
4444

45+
## Deploying Vite/Inertia Apps
46+
47+
If you’re using [Vite](/docs/frontend/vite) and [Inertia.js](/docs/frontend/inertia), the process is pretty much the same as deploying a regular Leaf app. However, you’ll need to build your assets before deploying to production. Here’s how you can do that:
48+
49+
::: code-group
50+
51+
```bash:no-line-numbers [NPM]
52+
npm run build
53+
```
54+
55+
```bash:no-line-numbers [Yarn]
56+
yarn build
57+
```
58+
59+
```bash:no-line-numbers [PNPM]
60+
pnpm run build
61+
```
62+
63+
:::
64+
65+
If you don't build your assets before deploying, you will either have a fully broken app or a CORS error in the case of Inertia.js, so make sure to build your assets before deploying or add it to your deployment script.
66+
4567
## Deploying Queues/Workers
4668

4769
When deploying your application with [queues](/docs/utils/queues), Leaf takes care of setting up the necessary files and commands based on your chosen queue driver. However, once deployed, you’ll need to set up your server to keep your workers running continuously.

0 commit comments

Comments
 (0)