flarelabs-net / vite-plugin-cloudflare

12 stars 1 forks source link

Unable to run example #12

Closed bjankord closed 1 month ago

bjankord commented 1 month ago

I know this is repo is currently in an experimental state, I was just looking at https://viteconf-2024-polyliths.slides.igor.dev/25?clicks=2 and wanted to see if I could run the example but ran into the following error when I tried:

failed to load config from /Users/redacted/Repos/vite-plugin-cloudflare/examples/worker/vite.config.ts error when starting dev server: TypeError: (intermediate value).resolve is not a function at file:///Users/redacted/Repos/vite-plugin-cloudflare/packages/vite-plugin-cloudflare/dist/index.js:119:44 at ModuleJob.run (node:internal/modules/esm/module_job:194:25)  ELIFECYCLE  Command failed with exit code 1.    Here are the steps I followed to try and test out the example:     git clone https://github.com/flarelabs-net/vite-plugin-cloudflare.git cd vite-plugin-cloudflare enable corepack pnpm install cd examples/worker/ pnpm dev   Thats when I get the error message.    I am using pnpm version 9.12.0    Really interested in exploring this for use with a User Worker + an Asset Worker to have a "Full Stack" edge app that can handle both API requests and serve our SPA with HMR support while running wrangler dev. From the slides I saw, this looks promising, just not sure what I'm missing to get the example running.

jamesopstad commented 1 month ago

What version of Node are you using? I suspect this is because it doesn't support import.meta.resolve natively. I've made a change so that import.meta.resolve isn't used. Could you try again now?

bjankord commented 1 month ago

@jamesopstad Ah that seems to be the issue. I forgot I was on node 18 when I cloned down the repo and tried running the example. I pulled down the latest changes from the repo and updated to the latest LTS version of node 20 and the example works for me now. Thank you!