analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Module resolution warnings under Yarn PnP: `Unable to resolve path to module '@vercel/analytics/react'.eslintimport/no-unresolved`

Open bitjson opened this issue 1 year ago • 5 comments

In this project, we're seeing the same warning from ESLint as is described in https://github.com/vercel/analytics/issues/18, but eslint-import-resolver-typescript is installed and working correctly for other packages. I suspect the issue is happening because we use Yarn PnP.

Currently, we're disabling import/no-unresolved for the import:

// eslint-disable-next-line import/no-unresolved
import { Analytics } from '@vercel/analytics/react';

But we're also seeing a warning (and maybe new issues with source maps) during production builds. E.g. the warning in a recent CI build:

.yarn/cache/@vercel-analytics-npm-1.1.2-cdbea53b32-01d2d4b9a1.zip/node_modules/@vercel/analytics/dist/react/index.js (1:0) Error when using sourcemap for reporting an error: Can't resolve original location of error.

These warnings also don't seem to be resolved by unplugging the package.

Other than these warnings, analytics otherwise seem to be working.

bitjson avatar Jan 25 '24 18:01 bitjson

+1

andy3520 avatar Jan 28 '24 11:01 andy3520

Hello. We recently changed the package exports. I don't know if it'll solve this particular issue, but it may have an effect. Would you mind trying version 1.2.2? Thanks!

feugy avatar Feb 21 '24 08:02 feugy

Getting: ESLint: Missing file extension "mjs" for "@vercel/analytics/react"(import/extensions)... version 1.1.4 was working just fine...

paulbuechner avatar Mar 02 '24 02:03 paulbuechner

@paulbuechner which version are you on now?

tobiaslins avatar Mar 04 '24 11:03 tobiaslins

I'm on latest 1.2.2

Doing // eslint-disable-next-line import/extensions for now

paulbuechner avatar Mar 04 '24 11:03 paulbuechner