masroorejaz / react-simple-captcha

A very simple and powerful captcha for ReactJS
40 stars 19 forks source link

Cannot use import statement outside a module #11

Closed ghost closed 2 years ago

ghost commented 3 years ago

SyntaxError: Cannot use import statement outside a module

This error happened while generating the page. Any console logs will be displayed in the terminal window. Source react-simple-captcha (1:0) @ eval

module.exports = require("react-simple-captcha");

masroorejaz commented 3 years ago

Are you using Next.js or any other framework?

masroorejaz commented 3 years ago

Closing this issue due to no response

tiavina-mika commented 2 years ago

I've get this error too, I'm using NextJs

naitschi commented 2 years ago

Reopen please. Also get the Error in React App on Node Server.

[nodemon] 1.19.1 [nodemon] to restart at any time, enter rs [nodemon] watching: public/node/*/ [nodemon] starting node public/node/server.js --experimental-modules /node_modules/react-simple-captcha/react-simple-captcha.js:1 import { Component } from 'react'; ^^^^^^

SyntaxError: Cannot use import statement outside a module at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/public/node/general-components/content-base/paragraphs/webform/paragraph-formular.js:50:27) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

masroorejaz commented 2 years ago

Check it at my end it's working fine.

Kindly recheck your code.

Thank you.

tanmayapatra09 commented 2 years ago

Are you using Next.js or any other framework?

Yes I am using NextJs and it is giving the same error

masroorejaz commented 2 years ago

It is not compatible with NextJS Framework yet. I do have making it compatible with NextJS in the future.

Than you.

Mudassarali222 commented 7 months ago

It is not compatible with NextJS Framework yet. I do have making it compatible with NextJS in the future.

Than you.

Hi, I think u complete the Next js version because now is 2024 how to use ?

masroorejaz commented 7 months ago

Here is the solution: https://github.com/masroorejaz/react-simple-captcha/issues/32

Mudassarali222 commented 7 months ago

O Its working.Thanks dear.