-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow adding additional functions to _worker.js
#10496
Comments
_worker.js
adapter-cloudflare
) Allow for adding additional functions to _worker.js
adapter-cloudflare
) Allow for adding additional functions to _worker.js
_worker.js
How would the local DX look like in this context? @smitssjors I think CF pages works now as long as you don't use anything specific to CF, |
@smitssjors That's a terrible DX as it only works on the build output you have to wait for a fresh build on each minute change |
@a-hariti Yes I agree, but that is out of the scope of this issue. I think that fixing that would require substantial work on how adapters integrate with kit and vite. Currently they just adapt the output of building. |
It could be an interesting idea to come up with something similar to how adapter node works. We could have a import { handle } from 'some-virtual-module'
export default {
fetch: handle
} |
Though I only think this would work when deploying to workers right? |
@ghostdevv To me this looks like a nicer solution. The node adapter docs are not clear where the custom server will live e.g., does kit copy over all files in src or does a user need to copy them over manually?
I think so. |
+1 |
Sorry for resurrecting this issue, but I've got a use case which would greatly benefit from using queues as well as a scheduled worker. Are there any further requirements for this beyond simply adding an option to the Cloudflare adapter which imports functions from a defined file and adds them to the generated worker? If not, this seems fairly easy to implement, I might be able to put together a PR this weekend. |
Other handlers don't seem to be supported for the Cloudflare Pages function. See #13207 (comment) and #13207 (comment) |
Describe the problem
Cloudflare Queues is currently in open beta. It would be nice to be able to consume messages from the same worker that handles HTTP requests, as opposed to having to creating a separate worker. For a worker to consume from a queue a new
queue
function needs to be defined on the worker object.Currently there is no easy way to add this
queue
function to the woker object in the generated_worker.js
.Other Cloudflare services such as Email Workers follow a similar approach.
Describe the proposed solution
I'd suggest a special
src/cloudflare-worker.js
file which would export functions such asqueue
which then during compilation get added to the_worker.js
file.Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: