Skip to content
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

Node v21 - navigator object #2122

Closed
sadiqsalau opened this issue Oct 17, 2023 · 3 comments
Closed

Node v21 - navigator object #2122

sadiqsalau opened this issue Oct 17, 2023 · 3 comments

Comments

@sadiqsalau
Copy link

Can't compile when using Node v21 because of the introduction of navigator object.

@nex3
Copy link
Contributor

nex3 commented Oct 17, 2023

Can you provide more details? What fails specifically? Why do you think the navigator object is related?

@bricss
Copy link

bricss commented Oct 17, 2023

Compiler fails with following error: TypeError: Cannot read properties of undefined (reading 'indexOf') 💥
Bcos of this code:

function(hooks) {
  if (typeof navigator != "object") return hooks;
  var ua = navigator.userAgent;
  if (ua.indexOf("DumpRenderTree") >= 0) return hooks;
  if (ua.indexOf("Chrome") >= 0) {
    function confirm(p) {
      return typeof window == "object" && window[p] && window[p].name == p;
    }
    if (confirm("Window") && confirm("HTMLElement")) return hooks;
  }
  hooks.getTag = getTagFallback;
}

Whereas navigator.userAgent is undefined 🥴

@nex3
Copy link
Contributor

nex3 commented Oct 17, 2023

It's astonishing to me that Node.js thought it would be a good idea to add a global navigator object, but setting that aside: this is an issue with the standard code generated by dart2js, and should be filed against https://github.com/dart-lang/sdk. There's nothing we can do in Dart Sass to fix this.

Note that Node.js 21 is also not an LTS release, and thus may receive less support than an even-numbered release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants