Conversation
…th module rules When importing non-JavaScript files (like .graphql, .txt, etc.) using TypeScript path aliases defined in tsconfig.json, Wrangler's module-collection plugin now correctly resolves these imports by passing the importer context to esbuild's build.resolve() function. Fixes #2954 Co-Authored-By: mkane@cloudflare.com <m@mk.gg>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: 495c60d The changes in this PR will be included in the next version bump. 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 |
petebacondarwin
approved these changes
Dec 16, 2025
5 tasks
Merged
AmirSa12
pushed a commit
to AmirSa12/workers-sdk
that referenced
this pull request
Jan 5, 2026
…th module rules (cloudflare#11649) When importing non-JavaScript files (like .graphql, .txt, etc.) using TypeScript path aliases defined in tsconfig.json, Wrangler's module-collection plugin now correctly resolves these imports by passing the importer context to esbuild's build.resolve() function. Fixes cloudflare#2954 Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2954.
Devin PR requested by @ascorbic
When importing non-JavaScript files (like
.graphql,.txt, etc.) using TypeScript path aliases defined intsconfig.json, Wrangler's module-collection plugin was not correctly resolving these imports. This was because thebuild.resolve()call was using a hard-codedkind: "import-statement"without passing theimportercontext, which prevented esbuild from applying the tsconfig path mappings.The fix passes
args.kindandargs.importertobuild.resolve(), allowing esbuild to properly resolve path aliases for non-JS modules.Example that now works:
Human Review Checklist:
args.kindandargs.importerdoesn't break existing non-aliased module resolutionLink to Devin run: https://app.devin.ai/sessions/359225f1b8cc46d5a846f1dbd6dcfd26