workers-sdk
workers-sdk copied to clipboard
Vite Plugin error after saving the entrypoint file twice
Which Cloudflare product(s) does this pertain to?
Vite Plugin
What versions & operating system are you using?
Wrangler 4.13.2, @cloudflare/vite-plugin 1.0.8, node 22
Please provide a link to a minimal reproduction
https://github.com/cloudflare/agents-starter
Describe the Bug
Changing the main entry point file triggers a rebuild in vite, if you save the file again while building then fails with the following error:
[vite] Internal server error: /path/to/file.ts does not export a default entrypoint.
Which is not true. The file does contains a default entry point.
It seems there is a race condition.
Please provide any relevant error logs
Clone the cloudflare/agents-starter repo or run to create a version of it
npm create cloudflare@latest -- --template cloudflare/agents-starter
then run :
npm install
npm run start
while the project is running, try the following command:
echo >> ./src/server.ts ; sleep 1 ; echo >> ./src/server.ts
once vite enters this state, there is no way to fix it other than restarting vite dev.
I'm not able to reproduce this and the linked issue has been closed. Are you able to confirm if this is still an issue? Thanks.
I'm not able to reproduce this and the linked issue has been closed. Are you able to confirm if this is still an issue? Thanks.
Hey. This still happens to me on v4.19.2
When I make changes to worker file at src/worker.ts during wrangler dev --remote, it'll reupload things fast and then vite will throw this error. Only way is to restart vite server
I'm not able to reproduce this and the linked issue has been closed. Are you able to confirm if this is still an issue? Thanks.
Hey. This still happens to me on v4.19.2
When I make changes to worker file at src/worker.ts during wrangler dev --remote, it'll reupload things fast and then vite will throw this error. Only way is to restart vite server
I might be missing something, could you clarify what your development workflow is and how wrangler dev --remote relates to vite there?
Also, if you could provide a minimal (consistent) reproduction that would be really helpful 🙏
I might be missing something, could you clarify what your development workflow is and how wrangler dev --remote relates to vite there?
I'm using the @cloudflare/vite-plugin, experiencing the exact same thing as OP does. When you clone https://github.com/cloudflare/agents-starter and try to make changes fast, it tries to upload each change one by one and then you get an error just like OP described. Only way is to restart vite server.
I wonder if this is related to https://github.com/cloudflare/workers-sdk/issues/9518
@maiznadeem Are you able to provide steps to reproduce? I have a PR up (https://github.com/cloudflare/workers-sdk/pull/10001) that I suspect might fix this but I'm unable to confirm without a reproduction. Thanks.
hi @jfromaniello and @maiznadeem :) we believe this should now be fixed with https://github.com/cloudflare/workers-sdk/pull/10001, so we're going to close this issue. if you're still running into problems, please feel free to open a new issue referencing this one. please be sure to include an updated summary and a repro and will revisit and investigate further. thanks!