-
-
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
fix: check property descriptors for configurability before polyfill #10273
Conversation
🦋 Changeset detectedLatest commit: 3038c7d 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 |
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 will close #10252
I'm still really confused how a VS Code extension is injecting itself into the Node runtime. That sounds bad, especially if it's written in such a way that breaks other tools trying to install their own polyfills later. Is there some way we could be more forceful in trying to overwrite these polyfills? Mark the existing values as configurable, maybe? If we can't do that for some reason, I'd want us to be throwing a more helpful error here, rather than just accepting the pre-existing polyfilly. We have no idea how old that's going to be, or what features it's going to be missing, or even whether it's actually a polyfill of the API we want. If we just continuing on our way here - even with a warning - this is much more likely to result in bizarre behavior for someone that is going to be almost impossible to debug for everyone else because "installed this fucked-up editor extension" isn't going to be one of the reproduction steps. |
@Conduitry https://marketplace.visualstudio.com/items?itemName=WallabyJs.console-ninja#how-does-it-work
|
I checked some frameworks supported by Console Ninja like next/astro, they use webapi polyfill and it works fine:
I think this should be a very common usage pattern: "polyfill if not exist". |
@Conduitry correct me if I'm wrong but I believe we did not do this because for example |
I did some sleuthing of old commits and found the reason this isn't safe: #8991 (comment). I think we could change this in SvelteKit 2.0 by dropping versions of Node older than 18.11, but I think we should probably close this PR until then - especially since the issue this was attempting to fix (#10252) has already been closed and can be addressed by upgrading to Console Ninja > v0.0.167 |
I filed an issue to track this for Kit 2.0 so that we won't forget: #10527 |
@dummdidumm Sorry, I had missed your message before. For I'm in general really wary about defaulting to using the versions of anything that is already there, even for non-undici stuff. It would at least very likely need to be marked as a breaking change, and I don't want to have to worry about the implications of doing that. The original version of this PR (6af78f9) actually feels a lot safer to me than what it has now. If a property on As I write this, I see that @benmccann has just now closed the PR, which does, all around, seem the safest to me. If we don't have to work around another project setting this as a non-configurable global, great. |
Before installing polyfills, other libraries may have already Polyfilled, and these libraries may have set incorrect
configurable
or/andwritable
, which can cause the failure of executingObject.defineProperty
. For example, the vscode extension Console Ninja can prevent the startup of yarn dev with error:Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.