Can I fix TypeScript imports to use only @ns/pkg instead of @ns/pkg/subdir/xy automatically?

Viewed 17

I have imports like this:

import { some } from '@namespace/pkg/some/other';

The package has proper index file now, so I want to change all imports to:

import { some } from '@namespace/pkg';

There are many imports to change. Can I automate this using VsCode or something else?

1 Answers

Never mind.. VScode mass replace can do it using regexps.

You might also need the auto import plugin to merge all the @some/pkg imports, but recent VSCode versions might be able automatically do that.

Related