nextjs-google-analytics icon indicating copy to clipboard operation
nextjs-google-analytics copied to clipboard

Requires "tslib" manual install

Open Yukigamine opened this issue 2 years ago • 1 comments

Just like in issue #278 I am receiving the Module not found: Can't resolve 'tslib' error until I install tslib.

Luckily it seems that it is only required as a devDependency and the error goes away once installing it there.

Yukigamine avatar Nov 09 '23 21:11 Yukigamine

This is happening for me too. It works fine locally, but when I deploy to Vercel the Vercel builds fail with:

./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/nextjs-google-analytics/dist/components/GoogleAnalytics.js:4:0
--
12:10:34.507 | Module not found: Can't resolve 'tslib'
12:10:34.507 |  
12:10:34.508 | https://nextjs.org/docs/messages/module-not-found
12:10:34.508 |  
12:10:34.508 | Import trace for requested module:
12:10:34.508 | ./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/nextjs-google-analytics/dist/components/index.js
12:10:34.508 | ./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/nextjs-google-analytics/dist/index.js
12:10:34.508 | ./components/Analytics/Analytics.tsx
12:10:34.508 | ./components/Analytics/index.ts
12:10:34.508 | ./pages/_app.page.tsx

To fix this I had to add tslib to my dependencies.

EvHaus avatar Dec 25 '23 20:12 EvHaus