Weird webpack error with nextjs, libsql and pnpm workspaces

Hello there! šŸ‘‹

I have a side project that uses drizzle with turso in a pnpm workspace with the following structure:

.
ā”œā”€ā”€ apps/
│   └── web/
│       └── package.json
ā”œā”€ā”€ packages/
│   └── db/
│       └── package.json
ā”œā”€ā”€ package.json
└── pnpm-workspaces.yaml


The web app is a Remix app with Vite, and the db package is turso + drizzle, using a db file for local development. Everything works flawlessly and the DX is awesome. Loving Drizzle so far šŸ’–šŸ’–šŸ’–

The thing is, I wanted a similar setup but with nextjs instead. Webpack hates it and fails to compile with the error shown in the screenshot šŸ™ƒ Works fine when moving the db files inside the web app, but then I loose the monorepo structure and I kinda need it for my next project šŸ˜…

I've uploaded a minimal repro here https://github.com/carloitaben/nextjs-pnpm-monorepo-libsql-webpack-repro

Any ideas? I'm new to monorepos and I'm really curious now šŸ¤” seems like a funny error. Could it be some ESM/CJS compatibility error? Or something in my tsconfig files?

Thanks in advance šŸ™‚
image.png
GitHub
Contribute to carloitaben/nextjs-pnpm-monorepo-libsql-webpack-repro development by creating an account on GitHub.
Was this page helpful?