vercel / analytics

Privacy-friendly, real-time traffic insights
https://vercel.com/analytics
Mozilla Public License 2.0
429 stars 26 forks source link

react/jsx-runtime module not found #2

Closed GitQuist closed 2 years ago

GitQuist commented 2 years ago

I'm getting the following build error. Using React: 17. Implemented according to guide.

Any idea on how to solve it?

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/usr/folder/project/node_modules/react/jsx-runtime' imported from /Users/usr/folder/project/node_modules/@vercel/analytics/dist/react/index.js Did you mean to import react/jsx-runtime.js?

yonbergman commented 2 years ago

A workaround that seemed to work for us was to follow this comment and add next-transpile-modules to the config file

// next.config.js
const withTM = require('next-transpile-modules')(['@vercel/analytics'])
modules.exports = withTM(config)
filipedeschamps commented 2 years ago

I can confirm the exact same problem. I'm using:

    "@vercel/analytics": "0.1.1",
    "next": "12.3.1",
    "react": "17.0.2",

And Node v16.17.1

chriswdmr commented 2 years ago

We just published 0.1.2 that resolves this issue