ES6 - Convert from 'require' to 'import'

Solution 1:

Nearly. It does however depend on how you are exporting them.

  • named exports (export var batz = …):

    import {batz as Bar} from 'foo';
    
  • default-exported object (export default {batz: …};) - should not be used:

    import Foo from 'foo';
    var Bar = Foo.batz;