N
Nuxt‱8mo ago
Smako

Typescript + Nodemon + Paths đŸ€Ż

Hello everyone, I'm calling on the typescript “expert” because I'd like to understand how transpilation works using nodemon. To explain, I have a project using pnpm workspace in which I have a file tsconfig.base.json and packages/backend/tsconfig.json. In my backend, I use nodemon file to develop. When I run nodemon I get the attached error even though the “paths” are present in the tsconfig file and the src/config/index file exists. Questions: - Is my config consistent? - Does it have anything to do with compilation options (these options are unclear to me)? : “target”: “ESNext”, “module”: “ESNext”, “moduleResolution”: “Bundler” Thanks for your help
tsconfig.base.json
{
"exclude": ["node_modules", ".vscode"],
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"baseUrl": "./",
"skipLibCheck": true,
"isolatedModules": true,
"useDefineForClassFields": true,
"noImplicitThis": true,
"types": [],
"noEmit": true,
"strict": true,
"sourceMap": false,
"esModuleInterop": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"declaration": false,
"removeComments": true,
"strictNullChecks": true,
"emitDecoratorMetadata": true,
"allowSyntheticDefaultImports": true
}
}
tsconfig.base.json
{
"exclude": ["node_modules", ".vscode"],
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"baseUrl": "./",
"skipLibCheck": true,
"isolatedModules": true,
"useDefineForClassFields": true,
"noImplicitThis": true,
"types": [],
"noEmit": true,
"strict": true,
"sourceMap": false,
"esModuleInterop": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"declaration": false,
"removeComments": true,
"strictNullChecks": true,
"emitDecoratorMetadata": true,
"allowSyntheticDefaultImports": true
}
}
packages/backend/tsconfig.json
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["./*"],
"@config/*": ["src/config/*"]
}
},
"include": ["src/**/*.ts", "**/*.spec.ts", "**/*.test.ts"],
"ts-node": {
"require": ["tsconfig-paths/register"],
"esm": true
}
}
packages/backend/tsconfig.json
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["./*"],
"@config/*": ["src/config/*"]
}
},
"include": ["src/**/*.ts", "**/*.spec.ts", "**/*.test.ts"],
"ts-node": {
"require": ["tsconfig-paths/register"],
"esm": true
}
}
nodemon.json
{
"watch": ["src"],
"ext": "ts,json",
"exec": "node --loader ts-node/esm -r tsconfig-paths/register src/index.ts",
"events": {
"restart": "clear"
}
}
nodemon.json
{
"watch": ["src"],
"ext": "ts,json",
"exec": "node --loader ts-node/esm -r tsconfig-paths/register src/index.ts",
"events": {
"restart": "clear"
}
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server