vercel / analytics

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

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

Open bitjson opened 9 months ago

bitjson commented 9 months ago

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.

andy3520 commented 9 months ago

+1

feugy commented 8 months ago

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!

paulbuechner commented 8 months ago

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

tobiaslins commented 8 months ago

@paulbuechner which version are you on now?

paulbuechner commented 8 months ago

I'm on latest 1.2.2

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