altcha-org / altcha-starter-react-ts

0 stars 0 forks source link

ReferenceError: customElements is not defined #2

Closed bala223344 closed 1 day ago

bala223344 commented 1 day ago

<altcha-widget challengeurl="/api/captcha/challenge"

facing this issue. in next js. it worked once first time then throwing this. cannot resolve it by any means.

ReferenceError: customElements is not defined at file:///D:/Documents/ton-tg-app/node_modules/.pnpm/altcha@1.0.0/node_modules/altcha/dist/altcha.js:1707:1 at ModuleJob.run (node:internal/modules/esm/module_job:222:25) at async ModuleLoader.import (node:internal/modules/esm/loader:316:24) { page: '/' }

ovx commented 1 day ago

Hi, custom elements are usually not supported by server-sider-rendering engines. To fix this error, call a dynamic import('altcha') only when rended on the client (browser).

bala223344 commented 1 day ago

thanks so much for yout time! it is working.