vitevercelrollupsanityastrojs

Keep getting error `[vite]: Rollup failed to resolve import "tslib" from "/vercel/path0/node_modules/.pnpm/rxjs@7.8.1` upon deployments to vercel


I am building an AstroJS project with Sanity as CMS - on my development environment everything works fine and the build is also successful

enter image description here

But when I try to deploy the project to vercel, I keep getting an error and the build fails

[vite]: Rollup failed to resolve import "tslib" from "/vercel/path0/node_modules/.pnpm/rxjs@7.8.1

The complete log of error - enter image description here

I tried adding vite.config.ts and try to externalise the tslib.

I am kind of new to this vercel ecosystem and do not know the exact root of the problem.


Solution

  • I had the same issue, hitting the "Redeploy" button within Vercel and ensuring the cache is cleared fixed my issue!