react-native-reusables icon indicating copy to clipboard operation
react-native-reusables copied to clipboard

[ BUG ] Static rendering when exporting results in empty html files (Bad for SEO)

Open qhoarau opened this issue 11 months ago • 2 comments
trafficstars

Describe the bug When exporting app with static rendering, html files have an empty body content in dist folder

To Reproduce Steps to reproduce the behavior:

  1. Clone the base project according to documentation
  2. git clone https://github.com/mrzachnugent/react-native-reusables.git
  3. cp -R react-native-reusables/packages/templates/starter-base/ ./my-project
  4. cd my-project && npm install && npx expo install --fix
  5. npx expo export --platform web
  6. go to dist folder
  7. see that index.html body is empty (it shouldn't)

Expected behavior generated html files should have a body content like expo base template

Screenshots If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • Type: Build
  • OS: Windows 11

qhoarau avatar Dec 02 '24 07:12 qhoarau

Hey @qhoarau , unless something has changed recently that I’m unaware of, this seems to be the expected behavior.

"a single index.html in the output folder and has no statically indexable HTML." - https://docs.expo.dev/distribution/publishing-websites/

When you create a new expo project, and run the same command, do you get the same results?

mrzachnugent avatar Dec 02 '24 10:12 mrzachnugent

It is the expected behavior if the key inside app.json web.output = single.

But in the default project when we clone the starter-base https://github.com/mrzachnugent/react-native-reusables.git, web.output is set to "static" which should generate an html files for each page and it does BUT the body inside those html files is empty and need rehydration (not good for SEO).

When I build with a brand new expo project with web.output = static, I do get all the html files and the body inside those html files are not empty and filled with the expected content.

I can't really tell why, i'm not experienced enough.

qhoarau avatar Dec 03 '24 18:12 qhoarau

If you are still getting this error with the latest versions, please open a new issue and include a minimal reproduction repo.

mrzachnugent avatar Nov 18 '25 15:11 mrzachnugent