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

Difference between pnpm run dev and pnpm run pages:dev? #2

Open
clibequilibrium opened this issue Jan 3, 2024 · 3 comments
Open

Difference between pnpm run dev and pnpm run pages:dev? #2

clibequilibrium opened this issue Jan 3, 2024 · 3 comments

Comments

@clibequilibrium
Copy link

Hi !

Thank you for this poc !

What is the difference between pnpm run pages:dev and pnpm run dev and when one uses one over another?
Thanks.

@gerhardcit
Copy link
Contributor

as per the package.json

    "dev": "vite dev",
...
    "pages:dev": "wrangler pages dev --compatibility-date=2023-11-21 --proxy 5173 -- pnpm run dev",

pnpm dev just runs the basic vite dev, which is sveltekit standard dev
but to use miniflare binding, you have to run wrangler pages dev that proxies to the output of vite dev which is typically on port 5173
this way you have sveltekit live reloads (HMR) and the benefits of simulating your cloudflare backend workers functions that uses miniflare to achieve that.

@clibequilibrium
Copy link
Author

clibequilibrium commented Jan 3, 2024

as per the package.json

    "dev": "vite dev",
...
    "pages:dev": "wrangler pages dev --compatibility-date=2023-11-21 --proxy 5173 -- pnpm run dev",

pnpm dev just runs the basic vite dev, which is sveltekit standard dev but to use miniflare binding, you have to run wrangler pages dev that proxies to the output of vite dev which is typically on port 5173 this way you have sveltekit live reloads (HMR) and the benefits of simulating your cloudflare backend workers functions that uses miniflare to achieve that.

Hmm, for me pnpm dev worked just fine and I had KV and D1 working ? Could you please confirm that there is indeed a need for pages:dev ?

EDIT: or it's only needed if you use worker functions API ?

@gerhardcit
Copy link
Contributor

Hmm, good point.. pages:dev might have been left over from previous methods.
you right. the hooks.server.ts will handle miniflare without the need for wrangler pages dev
unless you fiddle with environment variables to run against remote dbs for testing etc.

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

No branches or pull requests

2 participants