vite-plugin-cloudflare icon indicating copy to clipboard operation
vite-plugin-cloudflare copied to clipboard

Basic example with vite-plugin-ssr doesn't seem to work

Open alexturpin opened this issue 2 years ago • 6 comments

I've finally started integrating vite-plugin-ssr in my vite-plugin-cloudflare project and have been running into some issue.

Decided to take a step back and attempt the VPS example from this repo, but that doesn't seem to work either. I'm hoping I'm doing something wrong! I've got a copy of the example in this repo.

When running npm run dev and accessinh /, the page renders:

could not find index.html in your content namespace

And the console output is:

Error: [[email protected]][Wrong Usage] Cannot find production build. Did you to run `$ vite build`? If you did, then you may need to use `importBuild.cjs`, see https://vite-plugin-ssr.com/importBuild.cjs

Any idea what might be happening?

alexturpin avatar Apr 20 '23 21:04 alexturpin

Thanks for the issue, Sure, let me check what's happening!

Aslemammad avatar Apr 21 '23 05:04 Aslemammad

Yes, it's an issue with an update of vps, because it works completely ok with "vite-plugin-ssr": "0.4.18"! Anyways, I'll see how I can solve it.

cc @brillout

Aslemammad avatar Apr 21 '23 08:04 Aslemammad

No, it's still not working in your repo, even with the downgrade :smile:

Aslemammad avatar Apr 21 '23 08:04 Aslemammad

I did npm run build and then npm run dev and everything is working! Is there any specific issue?

Aslemammad avatar Apr 21 '23 11:04 Aslemammad

Yes, but it shouldn't require npm build to work right?

Otherwise it defeats the point of vite-plugin-cloudflare's great DX if you have to run npm build every change.

alexturpin avatar Apr 21 '23 13:04 alexturpin

When you start a new project, you need the build, as far as I know, only the first time! I tried it in your repo one time, and after that, everything started working, with module reloads also! It does not need that on any change any more.

Let me know if that's the case for you. And also I'd like to see if that's expected for vps or not. Because on our end, we cannot do anything at least for now, unless otherwise is proven.

Aslemammad avatar Apr 21 '23 15:04 Aslemammad