I have a problem with my vscode extension having both client and server sides. There's also a shared folder used for both the server and client sides. I'm trying to include @shared/* but it gives me the error shown on screenshot.
I've tried many methods, but it seems like something is still missing.
// tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2022",
"lib": [
"ES2022"
],
"baseUrl": ".",
"rootDir": ".",
"outDir": "out",
"sourceMap": true,
"composite": true,
"declaration": true,
"declarationMap": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
},
"include": [
"*.ts"
],
"exclude": [
"node_modules"
],
"references": [
{
"path": "client"
},
{
"path": "server"
},
{
"path": "shared"
}
]
}
// client/tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es2022",
"lib": [
"es2022"
],
"rootDir": "src",
"outDir": "out",
"baseUrl": "..",
"tsBuildInfoFile": ".tsbuildinfo",
"paths": {
"@shared/*": [
"shared/src/*"
]
},
"strict": true,
"sourceMap": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
],
"references": [
{
"path": "../shared"
}
]
}
// server/tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es2022"
],
"target": "es2022",
"rootDirs": [
"src"
],
"outDir": "out",
"baseUrl": "..",
"tsBuildInfoFile": ".tsbuildinfo",
"paths": {
"@shared/*": [
"shared/src/*"
]
},
"composite": true,
"declaration": true,
"declarationMap": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"esModuleInterop": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
],
"references": [
{
"path": "../shared"
}
]
}
// shared/tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es2022",
"lib": [
"es2022"
],
"rootDir": "src",
"baseUrl": "..",
"outDir": "out",
"tsBuildInfoFile": ".tsbuildinfo",
"composite": true,
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"strict": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}
// client/src/extension.ts
import { StorageDataManager } from '@shared/storage-data-manager';
This line causes an error

'@shared/storage-data-manager'at runtime? Or are you using a bundler/other tool that will rewrite your code when you build it? As the documentation says: "this feature does not change how import paths are emitted bytsc, sopathsshould only be used to inform TypeScript that another tool has this mapping and will use it at runtime or when bundling".