ConvertKit / convertkit-react

React-based library to easily plug ConvertKit forms to your React applications
46 stars 3 forks source link

error - ReferenceError: require is not defined in ES module scope, you can use import instead #24

Open Garinmckayl opened 1 year ago

Garinmckayl commented 1 year ago

This file is being treated as an ES module because it has a '.js' file extension and '/node_modules/convertkit-react/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

simoncarriere commented 1 year ago

I'm Facing the same issue here. Any current fixes or workarounds?

dmishh commented 1 year ago

I have the same problem with NextJS 13

dmishh commented 1 year ago

Fixed it by importing ESM file from bin folder: import ConvertKitForm from 'convertkit-react/bin/convertkit-react.esm'