accessibility icon indicating copy to clipboard operation
accessibility copied to clipboard

ReferenceError: regeneratorRuntime is not defined

Open hmingv opened this issue 1 year ago • 7 comments

Hi I am using this tool in my Nuxt3 project.

But when I executed npm run dev, I encountered the following problem. I guessed it was because my dependency library version was too high, but I don't know which dependency it is. . . Could you please help me to have a look?

My dependencies are as follows: image

ReferenceError: regeneratorRuntime is not defined 12:09:24
at D:\projects\develop\demo\node_modules\accessibility\dist\main.js:768:56 at D:\projects\develop\demo\node_modules\accessibility\dist\main.js:871:6 at Object. (D:\projects\develop\demo\node_modules\accessibility\dist\main.js:1540:2) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at ModuleWrap. (node:internal/modules/esm/translators:170:29) at ModuleJob.run (node:internal/modules/esm/module_job:198:25) at processTicksAndRejections (node:internal/process/task_queues:96:5) { statusCode: 500, fatal: false, unhandled: false, statusMessage: undefined, __nuxt_error: true }

hmingv avatar Mar 15 '23 04:03 hmingv

image

Here are my previous dependencies, and accessibility works fine when using these dependencies.

hmingv avatar Mar 15 '23 04:03 hmingv

still facing the same issue in next js

mtahirgulzar avatar May 01 '23 10:05 mtahirgulzar

@hmingv I have no idea. Perhaps this could help?

ranbuch avatar May 15 '23 12:05 ranbuch

I had the same issue on an older Angular app, fixed it by installing regenerator-runtime and adding the next lines to polyfills.ts

import "core-js/es6";
import "regenerator-runtime/runtime";

georgescubogdan avatar Jun 28 '23 14:06 georgescubogdan

Having this issue in Next 13.4.19. I haven't found a workaround as yet, but will post if/when I do

owain-williams avatar Sep 19 '23 13:09 owain-williams

Having this issue in Next 13.4.19. I haven't found a workaround as yet, but will post if/when I do

Did you find any fix for this ?

noumanmoeen0 avatar Oct 23 '23 10:10 noumanmoeen0

Having this issue in Next 13.4.19. I haven't found a workaround as yet, but will post if/when I do

Did you find any fix for this ?

Sadly not. I mostly needed it for text-to-speech, and found a different package that fit my needs (speak-tts)

owain-williams avatar Oct 24 '23 09:10 owain-williams

@hmingv @mtahirgulzar @georgescubogdan @owain-williams @noumanmoeen0 I believe I've fixed this issue on version 4.5.9. Please give it a try if you still in search for an accessibility solution.

ranbuch avatar Mar 08 '24 14:03 ranbuch

Thank you very much for your continued attention to this Issue.

I'm excited to test the new version and bring you feedback.

Let me introduce you to my project environment: Nuxt project info: 11:40:53



I followed the documentation and here is what I did: image

image

I got the following error: image

hmingv avatar Mar 14 '24 03:03 hmingv

Thank you for the effort @hmingv! unfortunately the provided link to codesandbox.io doesn't work for me. Perhaps it's private (I'm not familiar with codesandbox)?

Please try to install version 4.5.10 end let me know how it goes.

ranbuch avatar Mar 15 '24 21:03 ranbuch

Oh, sorry, I shared the private link by mistake, the following link is public link

https://codesandbox.io/p/devbox/serene-shamir-fmm99j?file=%2Fapp.vue%3A6%2C1

hmingv avatar Mar 16 '24 06:03 hmingv

Version 4.5.10 got new error message:

image

When I set the page to Client-Side rendering, I got the following error:

image image

hmingv avatar Mar 16 '24 06:03 hmingv

@hmingv I was able to access and run the codesandbox app. I believe I have forked it and made a few changes.

  1. Updated to version 4.5.11.
  2. Made sure the older version is not cached by editing the nuxt.config file by adding this section:
vite: {
    optimizeDeps: {
      exclude: [
        'date-fns'
      ]
    }
}
  1. Edited the app.vue by removing the window.addEventListener as the onMounted event is being triggered after the window has already loaded (so just call new Accessibility(); immediately).

ranbuch avatar Mar 16 '24 08:03 ranbuch

Thanks for fixing this, it looks good now.

It’s just that this dependency uses window, so it does not support SSR. I added a new Nuxt Plugin to load it on the client, and it can be used normally now. Thank you.

https://codesandbox.io/p/devbox/serene-shamir-fmm99j?file=%2Fapp.vue%3A6%2C1

hmingv avatar Mar 18 '24 02:03 hmingv