Help with (new) monorepo tsconfig
Ive just started merging two codebases into a monorepo
basically i have
FM and reporting
we have a /tsconfig.json (in FM) and a /reporting/tsconfig.json
after merging all the /reporting tests passed, but then after updating the prisma.schema in /prisma/prisma.schema the reporting tests started to fail
both of these tsconfigs had
and a prisma client importing "src/prisma"
i've now moved /reporting/src to reporting/code and done a replace all on "src/" to "code/" and then changed all the "code/prisma" references to "src/prisma" so that we should be referencing FM's prisma client
but the paths in tsconifg are not resolving the way i expect...
21 Replies
I tried updating paths like this:
Ok i resolved this issue but now im getting
../src/server/db/PrismaClient.ts:3:21 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("src/env/server.mjs")' call instead.
To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field
"type": "module"
to '/Users/fotoflo/dev/fastmonitor/package.json'.
3 import { env } from "src/env/server.mjs";Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
hi @florida-dev i still ahve two packages
im thinjking to delete one actually
lets see
@florida-dev thanks for looking
Type 'import("/Users/fotoflo/dev/fastmonitor/node_modules/.prisma/client/index").reportingBatch' is not assignable to
type 'import("/Users/fotoflo/dev/fastmonitor/reporting/node_modules/.prisma/client/index").reportingBatch'.
wtf
clearly using two prisma clients
if i delete the/reporting/package.json and merge is that advisable @florida-dev ?
i merged the packages and added type:module get this now:
ReferenceError: require is not defined in ES module scope, you can use import instead
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
From /tsconfig
and from /reporting/tsconif g
i hate this tsconfig stuff
@florida-dev i let chatgpt merge my packages...
hahah
it did a good job 🙂
now i cd into reporting to run jest tho
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah i think they snuck in
can i cahnge something here?
err even my old jestconfig.js uses require
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nope
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
prety breezy
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
id be much happier of the tests ran successfully after each time
now jest still nto working
but i think it works
thats inside reporting
wow i think it worked
i just updated liek 30 files and suddly jest is running
ok now we're back to tsconfig stuff
...
import prisma from "PrismaClient";
Cannot find module 'PrismaClient' from 'reporting/code/test/testUtils.ts'Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
still same