Skip to content

Not compatible with Webpack 5 (Next.js 11) #122

@Vadorequest

Description

@Vadorequest

Expected Behavior

Shouldn't log warnings

Current Behavior

When importing the file import { init } from '@amplitude/node';, it yields the following output:

warn  - ./node_modules/@amplitude/node/esm/src/constants.js
Should not import the named export 'version' (reexported as 'SDK_VERSION') from default-exporting module (only default export is available soon)

It's hard to tell if it's a warning or an error. The warning is displayed at every rebuild.

It seems to be related to webpack 5, the @amplitude/node package might not be compatible with Webpack 5. This affects Next.js 10+. (Webpack 5 is enabled by default in Next.js 11)

Steps to Reproduce

  1. git clone git@github.com:UnlyEd/next-right-now.git nrn-refactor-amplitude && cd nrn-refactor-amplitude && git checkout refactor-amplitude && cp .env.local.example .env.local && yarn && yarn start
  2. Go to localhost:8888/api/status and look at the server console

image

Environment

  • SDK Version: "@amplitude/node": "1.6.1",
  • Node version: v14

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions