ranbuch / accessibility

add accessibility to your website
MIT License
287 stars 35 forks source link

ReferenceError: regeneratorRuntime is not defined #53

Closed hmingv closed 3 months ago

hmingv commented 1 year ago

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 commented 1 year ago

image

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

mtahirgulzar commented 1 year ago

still facing the same issue in next js

ranbuch commented 1 year ago

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

georgescubogdan commented 1 year ago

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";
owain-williams commented 9 months ago

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

noumanmoeen0 commented 8 months ago

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 ?

owain-williams commented 8 months ago

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)

ranbuch commented 3 months ago

@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.

hmingv commented 3 months ago

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 commented 3 months ago

provide a minimal reproduction

ranbuch commented 3 months ago

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.

hmingv commented 3 months ago

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 commented 3 months ago

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

ranbuch commented 3 months ago

@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'
      ]
    }
    }
  3. 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).
hmingv commented 3 months ago

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