-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: localStorage exception in Node 25+ #1880
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
base: main
Are you sure you want to change the base?
Conversation
|
Sounds like a regression on Node.js side |
|
Reported - nodejs/node#60704 let's wait an answer |
|
This also prevents Docusaurus dev server from starting: facebook/docusaurus#11545
|
|
I tried this patch locally for Docusaurus, and it didn't work under Node 25.2: I tried adding back the "require" removed, leading to another error: I tried adding back everything you removed and keeping the spread: ...Object.defineProperties({}, Object.getOwnPropertyDescriptors(global))No idea how to fix it. Need to double check, but I also think it fails on Node 24: Repro?: git clone [email protected]:facebook/docusaurus.git
cd docusaurus
yarn install
yarn start:website |
|
@slorber Yeah, I think we will need to wait Node.js answer here, we need to pass globals here, technically we can filter as a workaround, but I still think it is a Node.js regression, let's wait an answer from them |
|
This change in node is spec-compliant, so it's unlikely they'll revert it. I've re-worked the fix to handle one problem that turned out to be caused by The |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1880 +/- ##
=======================================
Coverage ? 92.38%
=======================================
Files ? 18
Lines ? 749
Branches ? 209
=======================================
Hits ? 692
Misses ? 54
Partials ? 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@tophf I still think it is a bug and should be reverted, any way I am fine with these changes too, do can fix eslint problem? |
In this PR? But that code is completely unrelated, so it'd be weird to change it here. What if I just exclude the file from eslint checks altogether and someone will deal with those issues separately? |
|
Yeah, I saw that. Thing is, it doesn't say what's wrong. If the project is using prettier I would expect it to be applied automatically without me doing anything. Should I run prettier explicitly myself? |
|
Okay, I found and ran |

The problem I'm fixing here is that Node 25+ throws on reading
localStoragethat occurs implicitly in...global:My fix is to use a "meta" clone via Object.getOwnPropertyDescriptors + Object.defineProperties, which copies literally every global and is arguably what f269fc0 intended to achieve. Hopefully there are no secret/sensitive globals used by this plugin.