Skip to content

Commit e4ddbc2

Browse files
In vite dev make sure that the account_id present in the user's config file is used for remote bindings (#11009)
* In `vite dev` make sure that the `account_id` present in the user's config file is used for remote bindings * add e2e test * add miniflare dependency * Update packages/vite-plugin-cloudflare/e2e/helpers.ts Co-authored-by: Pete Bacon Darwin <[email protected]> * update function name also in the invocation * remove old workers-types type import used in vite pluging e2e fixtures * update `workerConfig` to `worker.config` --------- Co-authored-by: Pete Bacon Darwin <[email protected]>
1 parent 7f4a6e7 commit e4ddbc2

File tree

17 files changed

+160
-9
lines changed

17 files changed

+160
-9
lines changed

.changeset/open-points-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": minor
3+
---
4+
5+
Allow users to provide an `account_id` as part of the `WorkerConfigObject` they pass to `maybeStartOrUpdateRemoteProxySession`

.changeset/tough-crabs-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/vite-plugin": patch
3+
---
4+
5+
Make sure that the `account_id` present in the user's config file is used for remote bindings

packages/vite-plugin-cloudflare/e2e/fixtures/basic/tsconfig.worker.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "./tsconfig.node.json",
33
"compilerOptions": {
44
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
5-
"types": ["@cloudflare/workers-types/2023-07-01", "vite/client", "node"]
5+
"types": ["@cloudflare/workers-types", "vite/client", "node"]
66
},
77
"include": ["api"]
88
}

packages/vite-plugin-cloudflare/e2e/fixtures/dynamic/tsconfig.worker.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "./tsconfig.node.json",
33
"compilerOptions": {
44
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
5-
"types": ["@cloudflare/workers-types/2023-07-01", "vite/client"]
5+
"types": ["@cloudflare/workers-types", "vite/client"]
66
},
77
"include": ["src"]
88
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "@cloudflare/vite-plugin-e2e-remote-bindings-config-account-id",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"build": "vite build",
8+
"buildAndPreview": "vite build && vite preview",
9+
"dev": "vite",
10+
"lint": "eslint .",
11+
"preview": "vite preview"
12+
},
13+
"devDependencies": {
14+
"@cloudflare/vite-plugin": "*",
15+
"@cloudflare/workers-types": "^4.20250204.0",
16+
"@eslint/js": "^9.19.0",
17+
"eslint": "^9.19.0",
18+
"eslint-plugin-react-hooks": "^5.0.0",
19+
"eslint-plugin-react-refresh": "^0.4.18",
20+
"globals": "^15.14.0",
21+
"miniflare": "*",
22+
"typescript": "~5.7.2",
23+
"typescript-eslint": "^8.22.0",
24+
"vite": "^6.1.0",
25+
"wrangler": "*"
26+
}
27+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
async fetch() {
3+
return new Response("Hello world");
4+
},
5+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"files": [],
3+
"references": [
4+
{ "path": "./tsconfig.node.json" },
5+
{ "path": "./tsconfig.worker.json" }
6+
]
7+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4+
"target": "ES2022",
5+
"lib": ["ES2023"],
6+
"module": "ESNext",
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"isolatedModules": true,
13+
"moduleDetection": "force",
14+
"noEmit": true,
15+
16+
/* Linting */
17+
"strict": true,
18+
"noUnusedLocals": true,
19+
"noUnusedParameters": true,
20+
"noFallthroughCasesInSwitch": true,
21+
"noUncheckedSideEffectImports": true
22+
},
23+
"include": ["vite.config.ts"]
24+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.node.json",
3+
"compilerOptions": {
4+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
5+
"types": ["@cloudflare/workers-types", "vite/client"]
6+
},
7+
"include": ["src"]
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { cloudflare } from "@cloudflare/vite-plugin";
2+
import { defineConfig } from "vite";
3+
4+
export default defineConfig({
5+
plugins: [
6+
cloudflare({
7+
configPath: "./wrangler.jsonc",
8+
inspectorPort: false,
9+
persistState: false,
10+
}),
11+
],
12+
});

0 commit comments

Comments
 (0)