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

Modify to use cloudflareDevProxy and load contents of wrangler.toml #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chimame
Copy link

@chimame chimame commented Nov 24, 2024

Overview

I modified it to use cloudflareDevProxy and load the contents of wrangler.toml.
With this change, the Cloudflare Workers settings should be reflected just by changing wrangler.toml.

Motivation

The current template uses @hiogawa/vite-node-miniflare to reproduce Cloudflare Workers in a local environment, but in this state the contents of wrangler.toml, the Cloudflare Workers configuration file, are not automatically loaded. Of course, it can be reproduced by manually adding the @hiogawa/vite-node-miniflare settings in vite.config.ts, but two changes are required, wrangler.toml and vite.config.ts.

So I tried to change the template to automatically load the contents of wrangler.toml using cloudflareDevProxy.

There are two cloudflare templates, but I have not changed the D1 side. If any changes are necessary, please let me know.

@cwagner22
Copy link

When I try to build the app generated by this template I get
Could not resolve "../worker-configuration" from "workers/app.ts"
The file is there but I guess it's due to being a .d.ts file. Probably better to add it to include of tsconfig.

@oxcabe
Copy link

oxcabe commented Nov 28, 2024

import "../worker-configuration.d.ts"; works for me as well.

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

Successfully merging this pull request may close these issues.

3 participants