I have a local library that exports a class called Foo, this is library is built into a module with nx if that matters.
the file of the class looks like this (simplified)
export class Foo {}
the index.js looks like this (simplified)
export * from /path/to/foo/file
in my project i import it with
import { Foo } from FooLib;
all of this works perfectly, no issues whatsoever
however this breaks if i rename the class in both files
export class Bar {}
import { Bar } from FooLib;
this results in node complaining
Error: export 'Bar' (imported as 'Bar') was not found in 'FooLib' (possible exports: Foo)
now this looks suspiciously like i did not rebuilt the library or forgot to install the new version but the lsp used by vscode recognizes the change, i can go to definition of the renamed class, which results in the appropriate file in node_modules.
also i can try to include Foo like before, which also fails
import { Foo } from 'FooLib';
the corresponding error, is simmilar in tone but has different formatting
Module '"FooLib"' has no exported member 'Foo'.
renaming the class back to Foo
fixes all those problems, meaning i can import the class under it's old name again, but I can't rename this class and have it work
I tried
- completely removing the node_modules of the project (and reinstalling the new FooLib)
- rebooting
Am I missing something obvious here?
Ensure that you are performing a clean build after renaming the class. Sometimes, residual artifacts from the previous build may cause unexpected issues. You can try running commands like npm clean or manually deleting the node_modules and dist directories before reinstalling and rebuilding.