Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. //regex for locating & replacing ES6 import/export syntax with commonJS require syntax.
  2. //this is not comprehensive. Used in a very basic scenario.
  3.  
  4. //find: import ([a-zA-Z\_\-]{1,}) from '([a-zA-Z0-9\.\/\-]{1,})'
  5. //replace: let $1 = require('$2')
  6.  
  7. //find: export default
  8. //replace: module.exports =
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement