Skip to content

Regression 25.2.0 - Cannot initialize local storage without a --localstorage-file path #60704

Description

@alexander-akait

Version

25.2.0

Platform

any

Subsystem

No response

What steps will reproduce the bug?

Touching localStorage global variable produce the problem

Ref: webpack/webpack#20119 (we fixed this, but jest is broken)
Ref: jestjs/jest#15888 (jest issue)

Another ref where logic is broken - jantimon/html-webpack-plugin#1880

And more

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

No warning

What do you see instead?

Any workarounds

Additional information

No response

Activity

  1. alexander-akait commented on Nov 13, 2025

    @alexander-akait
    Author

    Code to reproduce:

    const myVars = Object.keys(globalThis);
    
    for (const item of myVars) {
    	console.log(globalThis[item]);
    }

    Very often you need to run through all global variables, especial in tools like testing frameworks/bundlers/etc, so it should not throw an error when you touch this

  2. slorber commented on Nov 13, 2025

    @slorber

    This also broke Docusaurus production builds: facebook/docusaurus#11545

    The production build issue is caused by this npm "eval" lib we use (1m download, but legacy/archived and won't be patched): https://github.com/pierrec/node-eval/blob/master/eval.js

    This also broke our dev server through html-webpack-plugin: jantimon/html-webpack-plugin#1880

  3. Renegade334 commented on Nov 13, 2025

    @Renegade334
    Member

    Very often you need to run through all global variables, especial in tools like testing frameworks/bundlers/etc, so it should not throw an error when you touch this

    The core assumption that enumerating the global object should never raise an exception, or that it should be side-effect-free at all, is not a valid one. This action would already throw in Node.js >=19 in builds without crypto support, and can definitely throw in browser environments. (Indeed, it also throws in Node.js <=24 if experimental local storage is enabled.)

    I would have preferred this change to land in a major release for sure.

    Ditto, although it was technically an "unchange" – the specification-compliant throw-on-access behaviour existed in v24, albeit behind a flag.

  4. alexander-akait commented on Nov 13, 2025

    @alexander-akait
    Author

    @Renegade334 I am not against such changes, but this is definitely a breaking change for this release, as you can see many well-known packages are broken...

  5. aduh95 commented on Nov 13, 2025

    @aduh95
    Contributor

    Consider passing --no-experimental-webstorage as a flag or in your NODE_OPTIONS to unblock yourself if you're not using localStorage.

  6. Xe commented on Nov 14, 2025

    @Xe

    This bit us when building Docusaurus in Anubis

  7. cjihrig commented on Nov 14, 2025

    @cjihrig
    Contributor

    Given the breakage, it seems like #60351 should be reverted and the less severe bug it addressed (#60303) can be revisited.

  8. slorber commented on Nov 14, 2025

    @slorber

    Made my argument here to motivate a revert: #60351 (comment)

    TLDR:

    • the web spec behavior is questionable and probably historical
    • server runtimes !== web
    • Deno doesn't throw by default
    • this should probably be discussed in TC55 (Winter TC) to align the behavior of server runtimes
  9. alexander-akait commented on Nov 14, 2025

    @alexander-akait
    Author

    @slorber Agreed, at least we need time to migrate, Node.js can output a warning and after resolving this problem in TC55 change this behavior in the next major release, so we will have time to refactor code and make releases

  10. Renegade334 commented on Nov 14, 2025

    @Renegade334
    Member

    Rather than a pure reversion, the more useful approach for backing off this change (and one which would be consistent with the presence tests mentioned previously) would be to switch from option 2 to option 1 from #60303, ie. expose undefined rather than throwing. This should at least not re-introduce the previous break for actual storage consumers.

  11. added
    web-standardsIssues and PRs related to web-platform APIs and standards compliance.
    on Nov 14, 2025
  12. SimenB commented on Nov 14, 2025

    @SimenB
    Member

    Do we know why CITGM didn't flag this?

  13. richardlau commented on Nov 14, 2025

    @richardlau
    Member

    Do we know why CITGM didn't flag this?

    It did. #60677 (comment). The Release WG discussed, and based on the change being deliberate and in an experimental feature we decided not to block the release.

  14. 10 remaining items

  15. slorber commented on Nov 17, 2025

    @slorber

    Thanks for reverting the change!

    As far as I understand, you may still keep this change as-is for v26, which means we are delaying the breakage. It gives us time to upgrade the existing problematic call sites.

    Can you please help us migrate common patterns, such as cloning {...global}?

    See also #60750 (comment)

  16. SimenB commented on Nov 18, 2025

    @SimenB
    Member

    Just for reference - Jest's looping through all the globals would be replaced with #46558 if it's ever implemented

  17. added a commit that references this issue on Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    web-standardsIssues and PRs related to web-platform APIs and standards compliance.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions