Last active
April 16, 2020 09:44
-
-
Save marcagba/b3db943c8b87cf754216f9c79bdca7b8 to your computer and use it in GitHub Desktop.
Move from `import React from 'react'` to `import * as React from 'react'
This file contains hidden or 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
# 1. Deal with `import React from 'react'` lines | |
git grep -l "import React " | xargs sed -i '' "s/import\ React\ /import\ \*\ as\ React\ /g" | |
# 2. Deal with `import React, {...} from 'react'` lines | |
# Here we need one line with `import * as React from 'react';` | |
# and the other with `import {...} from 'react;' | |
# First we remove the `import React,` part | |
# The we insert befor the line `import * as React from 'react';` | |
git grep -l "import React," | xargs sed -i '' -e "s/import\ React,/import/g" -e "import\ {.*}\ from\ 'react';/ i\\ | |
import\ \*\ as\ React\ from\ 'react';" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment