astro-i18next
astro-i18next copied to clipboard
Add Support & Testing for Cloudflare Workers SSR
Hi @yassinedoghri , would this be possible for edge deploying? e.g Netlify/Vercel edge
Hey @francoromanol, I'm hoping to figure it out at some point, I have set up an example with Netlify but it doesn't seem to be working.
Also, there's an issue on that matter (https://github.com/yassinedoghri/astro-i18next/issues/26)
I'm currently focused on getting features out during my spare time. If anyone has an idea on how to fix that, I'm all ears.
Hey @yassinedoghri thanks for answering! I will try to check it out too. I also noticed I can't deploy to vercel/serverless since 1.0.0-beta.13
:
14:40:25 [build] Rearranging server assets...
[@astrojs/vercel] The module "pnpapi" inside the file "/Users/me/me/Work/project/node_modules/esbuild/lib/main.js" couldn't be resolved. This may not be a problem, but it's worth checking.
error Failed to parse /Users/me/me/Work/project/node_modules/esbuild-darwin-arm64/bin/esbuild as script:
Unexpected character '�' (1:0)
Do you know what could be happening?
Do you know what could be happening?
Sorry, no clue with that error message.
So, you were able to deploy prior to v1.0.0-beta.13... 🤔 That means it's probably got something to do with the recent changes.
As a start, I'll setup examples for Vercel and Cloudflare (which will probably not work but it'll help debugging I guess).
Yes, just tested it again. Okay, I will check everything again and ask in Vercel about this error.
Hi Yassine,
I created a discussion at Vercel, I'm not really sure if v1.0.0-beta.13
changes introduce this TS problem, but it may be worth to check.
Hey @yassinedoghri,
I forked the repo to contribute to this problem, but I never developed an Astro plugin — though reading the codebase is clear how it works —, how can I test the packages once I changed the code?
I see there is a build
command which creates the dist directory, but if I import it from an astro.config file it yields an error
// examples/vercel/astro.config.mjs
import astroI18next from "../../dist/";
What am I doing wrong?
Thanks
Hey @francoromanol,
No need to import the dist directory, I think the import looks for the package.json
file where imports are specified. So I think you can just import the folder like so:
// examples/vercel/astro.config.mjs
import astroI18next from "../..";
Haven't tried it though. I usually define the local astro-i18next
as a dependency with file:../..
. And I have yet to figure the best way to test these locally 😅
Hi @yassinedoghri,
Thanks, I finally made it. I will take a look and let you know if I find something :)
Hi again,
I track this the vercel error to commit ea939db76114ed0ffb5efec452d6fcfaefe8962c: feat: add option to show the default locale in the url (https://github.com/yassinedoghri/astro-i18next/pull/51)
I will try my best to find the change that created this issue.
Cheers!
Okay, I found the line:
// src/index.ts
100 // initializing runtime astro-i18next config
101 serverImports += `import {initAstroI18next} from "astro-i18next";`;
I assume this is the - initialize astro-i18next config and to make it available at runtime
mentioned in the PR.
I tested injecting the three scripts alone: imports
, i18nextInit
, astroi18nextInit
and it only failed with serverImports
when line 101 is defined.
106 injectScript("page-ssr", serverImports);
Any thoughts on this? Maybe it's the way of importing it?