VSCode update to 1.96.0 / Libs paths in Nx Monorepo are not recognized

Discussão em 'Angular' iniciado por pop, Dezembro 13, 2024.

  1. pop

    pop Guest

    I am not sure where exactly the issue is, however just by elimination I think it is VS Code and not Nx, Typescript or Angular, as I have only restarted VSC and it updated itself to the newer version which then brought up the issue at hand.

    I have a standard Nx setup with 3 libraries and 3 apps (Angular/Typescript).

    - apps
    |- app1
    |- app2
    |- app3
    - libs
    |- lib1
    |- lib2
    |- lib3
    tsconfig.base.json


    The (short) paths to the libs are defined in this tsconfig.base.json file

    {
    "compileOnSave": false,
    "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es6",
    "module": "esnext",
    "typeRoots": ["node_modules/@types"],
    "lib": ["es2019", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": ".",
    "paths": {
    "@ultim/lib1": ["libs/ultim-lib1/src/index.ts"], // <- HERE
    "@ultim/lib2": ["libs/ultim-lib2/src/index.ts"],
    "@ultim/lib3": ["libs/ultim-lib3/src/index.ts"]
    }
    },
    "angularCompilerOptions": {
    "strictTemplates": true
    },
    "exclude": ["node_modules", "tmp"]
    }


    It has been working all right since the initial setup.
    After the update VS Code now underlines these three paths in the imports statements as "couldn't find". The app compiles alright - but VSC is complaining?
    When adding a new import from one of the libraries, it resolves the path as relative to the component and that involves a lot of .../ instead of expected @ulitm/lib1

    All the solutions and half hacks I've seen until now seem to not apply to my case. Has anybody got the same issue/setup or maybe has an idea for a solution?

    Continue reading...

Compartilhe esta Página