I would like to know if there is any way to make the following change to all files at once
import component from 'Components/Path/compoent.ts'
to
const component = () => import('Components/Path/compoent.ts')
CodePudding user response:
In case you want to replace everything with this syntax, then a regex is your friend here:
import (\S ) from '([^'] )'
Replace with:
const $1 = () => import('$2')
To just replace the constant string:
import component from '([^'] )'
Replace with:
const component = () => import('$1')