frandiox / vitedge

Edge-side rendering and fullstack Vite framework
https://vitedge.js.org
MIT License
732 stars 31 forks source link

Error during wrangler publish: process is not defined #56

Closed marshallswain closed 3 years ago

marshallswain commented 3 years ago

Hi, @frandiox, I've finally got some more time to try this out. It looks like you've done quite a bit since I last tried vitedge. I've just started a new app and have run into an error during wrangler publish. Here are my steps:

  1. Create the vitessedge app. It looks like it's pre-configured to work with esbuild, which is awesome to see.
  2. Update the wrangler.toml with my app's name and account id.
  3. Run npm run build
  4. Run wrangler publish in the project root and see the following error:

Screen Shot 2021-08-26 at 6 07 20 PM

It seems like maybe the error has something to do with reading environment variables from process.env inside dist/worker/script.js.

I've tried this with the default npm dependency versions in the app and with all deps updated to the latest using npm-check-updates. I get the same results. Do you have any pointers for me? Have you seen this before? Thank you.

I'm running wrangler 1.19.0

frandiox commented 3 years ago

@marshallswain Hey, good to see you around again! I've tried the template and I cannot reproduce it but I've noticed something. When I build the project locally, all my built files have the same size as yours except worker/script.js. Yours is 926KiB, whereas mine is 679KiB. Therefore, I think there must be some issue with version dependencies.

-- I could actually reproduce it after removing my package-lock.json and starting a fresh one, I'm now checking which dependency is the issue

frandiox commented 3 years ago

@marshallswain Looks like it's some kind of regression in vue@3.2.5 or related packages (probably in the server-renderer). I've fixed the version to 3.2.4: https://github.com/frandiox/vitessedge-template/commit/301bb2227f2a79436ed86f4805809f85e10714c4 Can you try to make sure you have 3.2.4?

marshallswain commented 3 years ago

That did the trick. Thanks for finding that, @frandiox!