VSCode supports Regex matches for find and replace functions.

If you needed to find every instance of something that looked like: import ComponentA from '@some/path/ComponentA'

To be replaced with something similar to: const ComponentA = () => import('@some/path/ComponentA')

The syntax would simply be:

VSCode - Find

import ([A-z]+) from ('[^']+')

VSCode - Replace

const $1 = () => import($2)

You probably want to limit this search to specific paths. We used this find and replace to help a broad update to a large Vue based Single Page App, to help optimise the components for lazy loading.

The raw regex for this might be useful too. It looks broadly the same, but with appropriate delimiters:

/^import ([A-z]+) from ('[^']+')$/const $1 = () => import($2)/