-
Notifications
You must be signed in to change notification settings - Fork 791
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
Support sourcemaps in DevTools #3140
Conversation
🦋 Changeset detectedLatest commit: 38f5346 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.devprod.cloudflare.dev/workers-sdk/runs/4896386811/npm-package-wrangler-3140 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/3140/npm-package-wrangler-3140 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4896386811/npm-package-wrangler-3140 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4896386811/npm-package-cloudflare-pages-shared-3140 Note that these links will no longer work once the GitHub Actions artifact expires. |
Codecov Report
@@ Coverage Diff @@
## main #3140 +/- ##
==========================================
- Coverage 74.84% 74.63% -0.21%
==========================================
Files 179 179
Lines 10858 10899 +41
Branches 2880 2894 +14
==========================================
+ Hits 8127 8135 +8
- Misses 2731 2764 +33
|
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.
Nice! 😃 A few comments/questions...
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.
Should this have a changeset?
3b5f611
to
0847c11
Compare
What this PR solves / how to test:
This PR enables support for sourcemaps in DevTools when using Wrangler.
It works by intercepting CDP messages from the DevTools frontend and responding in Wrangler. In particular:
Network.loadNetworkResponse
is intercepted to provide DevTools with the right sourcemapDebugger.scriptParsed
is intercepted afterworkerd
in order to give schemes to URLs returned fromworkerd
(which allows DevTools to treat modules as file paths with folders)Two additional DevTools patches are also included. 14 is a more-compliant ping implementation (thanks @mrbbot!) and 15 integrates with the Wrangler changes to enable sourcemaps, and enables some additional DevTools features to improve the experience of the Sources panel.
To test, run this branch build of Wrangler against a worker (
wrangler dev
orwrangler dev --experimental-local
), and open up DevTools by pressing D. Replace the DevTools domain with the preview build of DevTools from this PR (currently https://ca712237.cloudflare-devtools.pages.dev/).Author has included the following, where applicable:
[ ] CI Testsworker-app
withwrangler dev
andwrangler dev --experimental-local
no-bundle-import
withwrangler dev --no-bundle
andwrangler dev --experimental-local --no-bundle
sites-app
withwrangler dev
andwrangler dev --experimental-local
Reviewer has performed the following, where applicable: