ES6 export/import

Without default export

utils.js (exporting)

export const foo = () => 'ooo'
export const bar = () => 'xxx'

or

const foo = () => 'ooo'
const bar = () => 'xxx'

export { foo, bar }

app.js (importing)

import { foo, bar } from './utils'

foo()

or

import * as utils from './utils'

utils.foo()

index.js (re-exporting)

export * from './utils'

With default export

utils.js (exporting)

export const bar = () => 'xxx'
export default () => 'ooo'

app.js (importing)

import foo, { bar } from './utils'

index.js (re-exporting)

export { default as foo, bar } from './utils'

or

export default from './utils' // re-export only the default export