I have changed a few images and replaced
I have changed a few images and replaced them with new ones. Despite npm run dev showing these changes, it seems for some reason npx wrangler dev is still showing the old files, this is despite the fact that I deleted them. Why is this, and how can I make it show the new images?
9 Replies
what is
npm run dev
running? are you using a framework?its running on react
im guessing the issue is you need to build your app before running wrangler dev - npm run dev is probs using something like vite dev, but wrangler dev will be pointing to the built output. so if you change something and don't build, you wont see changes in wrangler dev. you can use custom builds to watch for changes in wrangler dev: https://developers.cloudflare.com/workers/wrangler/configuration/#custom-builds
Cloudflare Docs
Configuration
Use a configuration file to customize the development and deployment setup for your Worker project and other Developer Platform products.
ahh i see
so would I need to run npm run build?
ahh i see
Im new to this so I dont really know how it works
but from my understanding, I need to run npm run build, anytime I make changes to the code?
does that mean when i change a line of code, i need to build it? Or do i just need tor un the command for when i change files?
and also I dont really understand whats the difference betwen npx wrangler dev --local, and npx wrangler dev --remote. Can you explain to me the difference a bit more?
I greatly appreciate the help, thank you
no worries - i might be able to help more with some more details about your project - did you start from one of the templates here maybe https://developers.cloudflare.com/workers/framework-guides/web-apps/react/ ?
basically i'd recommend just developing with
npm run dev
at first if its just got a react front end, and not using npx wrangler dev
for now so you don't have to worry about rebuilding.Cloudflare Docs
React + Vite
Create a React application and deploy it to Cloudflare Workers with Workers Assets.
yeah I started with react+vite
Im trying to use the KV storage for user data thought, and i heard you need npx wrangler dev fo that
do both local and remote access KV storage? Since ive had some problems trying to get that to work
the cf vite plugin (which is what that template uses) can locally emulate all the resources that wrangler dev can, its running the same thing under the hood - some edge cases, but kv works fine. what issues have you had?
(so npm run dev should give you access to kv)
It seems running npm run build fixed the issue
So, If i do npm run dev, it should be the same exact thing as npm wrangler dev?
if you look in package.json, it'll show you what the
dev
(ie npm run dev) script is doing. its not doing the exact same thing as wrangler dev, but it'll handle kv the same way, and vite will show you your changes instantly without having to rebuild.