-
Notifications
You must be signed in to change notification settings - Fork 716
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
fix: resolve raw file bindings correctly in wrangler dev
local mode
#756
Conversation
🦋 Changeset detectedLatest commit: 46ff829 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2089426666/npm-package-wrangler-756 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/756/npm-package-wrangler-756 Or you can use npx https://prerelease-registry.developers.workers.dev/runs/2089426666/npm-package-wrangler-756 dev path/to/script.js |
return new Response( | ||
JSON.stringify( | ||
{ | ||
// @ts-expect-error binding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yurgh I should declare an env.d.ts later/soon
5ceb295
to
3869d2c
Compare
packages/wrangler/src/dev/local.tsx
Outdated
const wasmBindings = { ...bindings.wasm_modules }; | ||
for (const [name, filePath] of Object.entries(wasmBindings)) { | ||
wasmBindings[name] = path.join(process.cwd(), filePath); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this results in copying over the properties twice. Once for the ...bindings.wasm_modules
spread operation, and then again for the path mapping.
Could we just do it in one go?
const wasmBindings = { ...bindings.wasm_modules }; | |
for (const [name, filePath] of Object.entries(wasmBindings)) { | |
wasmBindings[name] = path.join(process.cwd(), filePath); | |
} | |
const wasmBindings = { }; | |
for (const [name, filePath] of Object.entries(bindings.wasm_modules)) { | |
wasmBindings[name] = path.join(process.cwd(), filePath); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or am I missing something here?
If you are happy with this approach, then the same is true of the ones below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lemme quickly make changes here
packages/wrangler/src/dev/local.tsx
Outdated
const wasmBindings = { ...bindings.wasm_modules }; | ||
for (const [name, filePath] of Object.entries(wasmBindings)) { | ||
wasmBindings[name] = path.join(process.cwd(), filePath); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this is fine.
8853ba4
to
8a00710
Compare
8a00710
to
46ff829
Compare
For
wasm_modules
/text_blobs
/data_blobs
in local mode, we need to rewrite the paths as absolute so that they're resolved correctly by miniflare. This also expands some coverage for local modewrangler dev
.Fixes #740
Fixes #416