Last active
September 5, 2022 09:22
-
-
Save predorock/bbebcd3a7bb3900cae3c3d7fec1b1e1f to your computer and use it in GitHub Desktop.
RegEx to replace relative imports to absolute imports in vscode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pseudo code | |
const alias = 'environment' | |
(?<=from)((?!\'\.\/).)*?(?=alias) | |
or | |
(\.\.\/)+(?=alias) | |
//NOTE: I'am working with an angular cli project. So do the refactoring module by module in case you have to fix some issues due to import replacement | |
//instructions | |
- put the regular expression in the vs code replace input | |
- select the regular expression matching mode | |
- include only .ts files (for angular cli project 'src/app/**/*.ts') | |
- press enter to search all occourences an replace them with your new alias |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment