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

Crashes on Node 22.12.0 #767

Open
joelanman opened this issue Dec 10, 2024 · 5 comments
Open

Crashes on Node 22.12.0 #767

joelanman opened this issue Dec 10, 2024 · 5 comments

Comments

@joelanman
Copy link
Contributor

joelanman commented Dec 10, 2024

Appears to cause a crash on Node 22.12.0 when used as a dependency. It works on 22.9.0 if that helps.

2024-12-10T09:43:38.151622+00:00 app[web.1]: ReferenceError: self is not defined
2024-12-10T09:43:38.151623+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js:1:226)
2024-12-10T09:43:38.151623+00:00 app[web.1]: at Module._compile (node:internal/modules/cjs/loader:1565:14)
2024-12-10T09:43:38.151623+00:00 app[web.1]: at Object..js (node:internal/modules/cjs/loader:1708:10)
2024-12-10T09:43:38.151623+00:00 app[web.1]: at Module.load (node:internal/modules/cjs/loader:1318:32)
2024-12-10T09:43:38.151623+00:00 app[web.1]: at Function._load (node:internal/modules/cjs/loader:1128:12)
2024-12-10T09:43:38.151624+00:00 app[web.1]: at TracingChannel.traceSync (node:diagnostics_channel:322:14)
2024-12-10T09:43:38.151624+00:00 app[web.1]: at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
2024-12-10T09:43:38.151624+00:00 app[web.1]: at node:internal/modules/esm/translators:229:5
2024-12-10T09:43:38.151624+00:00 app[web.1]: at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:196:7)
2024-12-10T09:43:38.151624+00:00 app[web.1]: at ModuleJobSync.runSync (node:internal/modules/esm/module_job:395:35)
2024-12-10T09:43:38.151624+00:00 app[web.1]: 
2024-12-10T09:43:38.151625+00:00 app[web.1]: Node.js v22.12.0

Tested via these dependencies in the prototype kit:

    "@x-govuk/govuk-prototype-components": "3.0.4",
    "govuk-country-and-territory-autocomplete": "2.0.0",
    "hmrc-frontend": "6.4.0"

tested with version 3.0.1 of autocomplete

@joelanman
Copy link
Contributor Author

the accessible autocomplete package.json looks like this:

{
  "name": "accessible-autocomplete",
  "version": "2.0.4",
  "main": "dist/accessible-autocomplete.min.js",

with a reference to the file causing the issue - might that be related?

@joefhall
Copy link

joefhall commented Dec 16, 2024

I'm getting the same problem with Vite / SvelteKit (Node v20.17.0). I was able to get round it by disabling server-side rendering for the page where I'm using the accessible autocomplete, but obviously that isn't ideal.

@astagi
Copy link

astagi commented Feb 18, 2025

+1 can't use it right now in a Gatsby project, please make accessible-autocomplete SSR friendly 🙏

@astagi
Copy link

astagi commented Feb 18, 2025

cc @owenatgov

@astagi
Copy link

astagi commented Feb 18, 2025

I think that the problem resides in polyfills used to build the library (see also pixijs/pixijs#7703 (comment)). I tried to clone and build accessible-autocomplete using the following .browserlistrc configuration and self variable disappears.

last 6 Chrome versions
last 6 Firefox versions
last 6 Edge versions
last 2 Samsung versions

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

No branches or pull requests

3 participants