-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add x_google_ignoreList
(Ignore-listing code) support to sourcemaps
#4225
Comments
This doesn't look relevant to Preact? If I'm understanding correctly, that is something that needs to be configured in build tooling, not in libraries used. |
@rschristian My understanding was that when the framework (in this case Preact), distributes itself as a minimised bundle, this is something that should be enabled/used/included within it's sourcemaps. I believe that would then flow on to 'downstream' web app code as well (though don't quote me on that). |
https://developer.chrome.com/blog/devtools-modern-web-debugging/#just-my-code This doesn't appear to be targetting libraries, no. This is something downstream users should be in control of. Edit: As such, going to close this on out. |
@rschristian Do you not consider preact a framework? |
It's not, no. Nuxt, Next, Sveltekit, etc. are frameworks, Preact, Vue, React, Svelte, etc., are UI libraries. |
And Angular? Framework or 'UI library'? As they added support: I've generally seen React/etc referred to colloquially as a framework as well; so I wouldn't be so quick to dismiss the relevance on semantic differences. It looks like
I'm not deeply familiar with |
Take a look at where they added that change, it's in the Webpack config. Angular is a framework as they have very specific underlying tooling -- you have to write Angular apps with Angular CLI (a Webpack-based tool, though I think that's changing?). This ties Angular to its framework rather tightly, compared to (say) React & Next, Vue and Nuxt, Svelte and SvelteKit, etc.
I'm not dismissing this due to semantic differences but due to actual intention. This is meant to be implemented in another layer of your tooling, a layer which UI libraries do not control.
We maintain Microbundle. |
Fair enough.
I'm still not sure that that is correct. At the layer of preact, I believe it should mark itself to be ignored, so that shows in it's sourcemaps, so that then flows on to the sourcemaps of downstream projects that consume it's sourcemaps. I may be wrong; and it seems that even if i'm not I'm unlikely to convince you otherwise, so I'll drop the point.
Fair enough. Well you may or may not find this issue relevant there then, since it's a bundler (though I'm not really sure how a thing like this that should be configurable would be exposed through a 'no config' tool): |
Again, your Angular link is a great example here in usage: for (const [index, path] of map.sources.entries()) {
if (path.includes('/node_modules/') || path.startsWith('webpack/')) {
ignoreList.push(index);
}
} As shown, this is happening in a Webpack plugin, during the user's app build. This isn't something that needs to flow on downstream, the consumer/framework can handle this perfectly well on their own. Now, a good point of implementation could be |
This is the relevant link on the vite docs, but that's seemingly for the dev server:
Looking at vite's Looking at So from that, it would seem that How about a case where the end-app isn't bundled/transpiled/etc, and thus has no chance to mark And if that is true, then based on the above exploration, it seems that the solution for implementing the fix here would just be to set the And then if that holds true, it also seems that it would probably similarly hold for many/most/all(?) libraries that use It kind of feels like a case of "yes, implementing it at the bundler level is a nice 'catch-many' situation that avoids end libraries from having to do anything"; but I don't believe that negates it being a useful thing for an end library to implement directly? Again, could be wrong, and ultimately the decision is up to you and not something I'm going to push for/get upset if it's not done. Just trying to establish/understand/confirm if the assumptions that decision is based on are actually correct. |
Rather than just throwing this out there as a question, I decided to test it. Creating a tiny test file that loads <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Preact App</title>
<script src="https://unpkg.com/preact@latest/dist/preact.min.js"></script>
</head>
<body>
<div id="app"></div>
<script>
const { h, render, Component } = preact;
class App extends Component {
render() {
return h('h1', null, 'Hello from Preact!');
}
}
render(h(App), document.getElementById('app'));
</script>
</body>
</html> Looking at the 'Sources' tab, under 'Authored' -> 'unpkg.com', we can see that Now if I edit that source to add a class App extends Component {
render() {
+ debugger;
return h('h1', null, 'Hello from Preact!');
}
}
// ..snip.. We see that the full call stack is shown in the debugger, including all of the Now I can work around this by manually configuring the ignore list in my Chrome DevTools and adding a rule such as this:
Which will 'dim' the And it won't show at all when "Hide ignore-listed sources" is ticked: Now, repeating the And then if I want to see the Now while every developer who uses Looking at the following page, they also specifically say "framework or library":
As I said earlier, if you still choose not to implement this here, that's fair enough; but I don't believe the reasoning you originally based that decision on holds true. |
Introduce the
x_google_ignoreList
extension in the sourcemaps generated by this project. This will facilitate a more streamlined debugging experience in Chrome (and other supporting browsers) by automatically filtering out framework and dependency code.Benefit
Implementing
x_google_ignoreList
in the sourcemaps will align this project with modern web development practices, offering a more focused and efficient debugging experience for developers using Chrome DevTools. This change will particularly benefit those who regularly engage in debugging complex applications with numerous dependencies.Background Context
See Also
x_google_ignoreList
(Ignore-listing code) support to sourcemaps facebook/react#27774x_google_ignoreList
(Ignore-listing code) support to sourcemaps markerikson/react-prod-sourcemaps#19x_google_ignorelist
vercel/next.js#41370x_google_ignoreList
(Ignore-listing code) support to sourcemaps sveltejs/svelte#9740x_google_ignoreList
(Ignore-listing code) support to sourcemaps developit/microbundle#1066node_modules
and buildDir tox_google_ignoreList
nuxt/nuxt#19243sourcemapIgnoreList
configuration option vitejs/vite#12174x_google_ignoreList
rollup/rollup#4847sourcemapIgnoreList
config predicate rollup/rollup#4848The text was updated successfully, but these errors were encountered: