1

I'm trying to connect an NX project that uses paths to resolve library folders.

"paths": {
  "@nxlib/mylib/*": ["libs/mylib/src/lib/*"],
}

Currently I'm able to get VsCode on a fresh NX project to automatically update the import paths of relative files when I remove the "include":[] in each project/lib's tsconfig.json (as stated here: Can VS Code automatically update JavaScript and TypeScript import paths on file rename/move?)

Althouth if I start to use the alias path @nxlib/mylib/my-file renaming or moving my-file.ts does not automatically update the import paths.

Does anyone know how I can get renaming to work with paths aliases?

Jonathan002
  • 9,639
  • 8
  • 37
  • 58

1 Answers1

0

When you want to move or rename a package the best way is using the plugin workspace, because it'll change automatically the name of /tools/..., package.json, tsconfig.base.json...

Example

You want to rename the package app to app-v2.

To rename/move the library/app, you need to run this command:

nx g @nrwl/workspace:move --projectName=app --destination=app-v2

Or if you don't have Nx installed globally on your computer, then:

npx ng g @nrwl/workspace:move ...

You can find other commands (e.g. remove) at the bottom of the main menu enter image description here

Guillem Puche
  • 1,199
  • 13
  • 16