I would like to use AdonisJS in a mono repo managed by turbo repo. I have an admin app (React) and a backend app (AdonisJS). I have a type package to share my types between backend and frontend.
In my frontend I can import my types and constants without any problem. But in AdonisJS I get a module not found error.
I don't understand why.
I create test repository.
Ts config of adonis:
{
"extends": "@adonisjs/tsconfig/tsconfig.app.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "./build"
}
}
Ts config admin (React):
{
"extends": "./base.json",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": [
"ESNext",
"DOM"
],
"sourceMap": true,
"resolveJsonModule": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"jsx": "react-jsx"
},
"exclude": [
"node_modules"
]
}
Base config:
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
},
"exclude": [
"node_modules"
]
}
and here's the blocking code:
import router from '@adonisjs/core/services/router'
import { User, roles } from '@repo/type' // <- Unable to locate '@repo/type' module or type declarations correspondantes.ts(2307)
router.get('/', async () => {
const user: User = {
id: '1',
role: roles.admin,
}
return {
user,
}
})
I have tried different tsconfig.json but nothing works.