Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
s00d committed Oct 22, 2024
1 parent 461b7a8 commit 7729b3f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@ definePageMeta({ name: 'pageName' })
This ensures that the route is properly registered, and the application can navigate to it without issues.

---

## ❓ Why is the `assets/_locales/` folder added to the server folder?

When deploying to platforms like Netlify, the build process might behave differently compared to local development. This can lead to issues where certain files or folders are not found during server-side rendering (SSR).

### **Solution:**
To ensure that localization files are available during SSR, the `assets/_locales/` folder is added to the server folder. This is a workaround to make sure that the localization files are accessible in the production environment, especially when the build process and runtime environment differ.

### **Explanation:**
- **Build Process:** During the build, all translations are cached in the production folder. However, when deploying to platforms like Netlify, the server code is moved to functions, and there might be a separate container where locale files are not accessible.
- **Prerendering:** Prerendering does not work when using `$fetch` in SSR, leading to middleware not finding the localization files.
- **Server Assets:** To address this, the localization files are saved in the Nitro server assets during prerendering. In production, they are read from the server assets.

---

0 comments on commit 7729b3f

Please sign in to comment.