Skip to content

Issue on Next 12 - CommonJS script issue #11

@zsiegel

Description

@zsiegel

Hello

I recently updated a project of mine to Next 12 and then also updated the converkit-react library to 1.5.5.

When I startup the project and load my page with the form on it I now get the following error.

error - unhandledRejection: ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/workspaces/project/node_modules/convertkit-react/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

I do not think I am going anything special. This is a vanilla next project and I import the form with the following.

import ConvertKitForm from 'convertkit-react';

I am not sure what might be going wrong here but I see in the project history there was a release specifically for Next around commonjs a few releases back.

Maybe something has changed with Next 12?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions