Skip to content

Instantly share code, notes, and snippets.

@Makio64
Last active January 12, 2017 01:34
Show Gist options
  • Save Makio64/efa5be5de80f114253328ed525c4e939 to your computer and use it in GitHub Desktop.
Save Makio64/efa5be5de80f114253328ed525c4e939 to your computer and use it in GitHub Desktop.
regex to find the old way to require files & import it in the new way
\S*\s+(\S*)\s*=[ ]*require\(\s*["'](.*)["']\s*\)\s*;?
import $1 from '$2'
before:
const bouboup = require( 'blabla/bouboup' )
after:
import bouboup from 'blabla/bouboup'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment