Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support & Testing for Cloudflare Workers SSR #71

Open
L1lith opened this issue Nov 18, 2022 · 11 comments
Open

Add Support & Testing for Cloudflare Workers SSR #71

L1lith opened this issue Nov 18, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@L1lith
Copy link

L1lith commented Nov 18, 2022

No description provided.

@yassinedoghri yassinedoghri added the enhancement New feature or request label Nov 26, 2022
@fprl
Copy link

fprl commented Nov 28, 2022

Hi @yassinedoghri , would this be possible for edge deploying? e.g Netlify/Vercel edge

@yassinedoghri
Copy link
Owner

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.

image

Also, there's an issue on that matter (#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.

@fprl
Copy link

fprl commented Nov 30, 2022

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?

@yassinedoghri
Copy link
Owner

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).

@fprl
Copy link

fprl commented Nov 30, 2022

Yes, just tested it again. Okay, I will check everything again and ask in Vercel about this error.

@fprl
Copy link

fprl commented Dec 2, 2022

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.

@fprl
Copy link

fprl commented Dec 2, 2022

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

@yassinedoghri
Copy link
Owner

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 😅

@fprl
Copy link

fprl commented Dec 3, 2022

Hi @yassinedoghri,

Thanks, I finally made it. I will take a look and let you know if I find something :)

@fprl
Copy link

fprl commented Dec 4, 2022

Hi again,

I track this the vercel error to commit ea939db76114ed0ffb5efec452d6fcfaefe8962c: feat: add option to show the default locale in the url (#51)

I will try my best to find the change that created this issue.

Cheers!

@fprl
Copy link

fprl commented Dec 4, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants