#astro-i18n-aut in SSR mode

32 messages ยท Page 1 of 1 (latest)

polar obsidian
#

Does astro-i18n-aut work in SSR? If not any hints on a workaround? A duplicate of every page for each language I don't think is really going to work in our case but I think that is why my builds keep failing - the middleware in astro-i18n-aut depends on node - does that even sound right? @modern gorge

#

Also @modern gorge in Astro 2.9 (maybe before) redirects are no longer experimental - not entirely sure what impact that has on the package

modern gorge
#

@polar obsidian just bumped astro-i18n-aut and removed mentions of experimental redirects. It bumps the minimum astro version, removes warnings, and removes mentions of experimental from the docs

#

@polar obsidian the middleware does not depend on node. Only the build step before deploy depends on node. Which adapter are you using? Is your project on github?

polar obsidian
#

I was trying to use cloudflare

#

And this works awesome in dev - appreciate all your work!

#

I may have incorrectly identified the problem too

modern gorge
#

And this works awesome in dev - appreciate all your work!
glad to hear it ๐Ÿ˜„

polar obsidian
#

But every astro file returns a bunch of node errors when I try to build

modern gorge
#

are you building locally? GitHub Actions?

#

oh, and do you have logs of the errors?

polar obsidian
#

I tried local build in the project npm run build and also tried it connected with cloudflare

modern gorge
#

interesting, I do see the local build errors

polar obsidian
#

So far that is my best guess why basically every file with internationalization seems to be popping up with the errors ๐Ÿคทโ€โ™€๏ธ

modern gorge
#

what it could be is that those node packages are being pulled in through the utils, and I could try separating that out

#

since everything is exported in one index file

#

oh it seems you did separate that

polar obsidian
polar obsidian
modern gorge
#

I commented out every mention of astro-i18n-aut, and it seems like another library has node internals

#

For example, astro-icon depends on svgo which depends on node

#

I do think that astro-i18n-aut middleware may be part of the problem because Astro isn't tree-shaking, I'll see if separating that out fixes it

polar obsidian
#

Yeah I have been trying to strip packages out to see if I can get anything to build but not very successfully. Its odd because like astro-icon is written by one of the main Astro maintainers and I can't find anything that says it wouldn't work with SSR/Cloudflare

modern gorge
#

It seems that separating out the exports (not using one index.ts barrel file) fixes the remaining build errors ๐Ÿ˜„

I'll go ahead and make two separate files to import:

  • the utils and middleware
  • the integration

You'll need to:

polar obsidian
#

@fallow ivy Is astro-icon not SSR compatible? I found some posts from October 2022 that it wasn't SSR ready but nothing since - is this still on the roadmap?

modern gorge
#

@polar obsidian the good news is it builds with the new package structure! The bad news it the types don't work yet

polar obsidian
#

Building is more progress than I made today ๐Ÿ˜… so progress is progress!

#

And I appreciate the prompt replies and help!