Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The complete ES module upgrade guide - part 2
// NAMED EXPORT
// index.mjs
import { sum } from './module';
console.log(sum(1, 2));
// module.mjs
export const sum = (a, b) => a + b;
// DEFAULT EXPORT
// index.mjs
import sum from './module';
console.log(sum(1, 2));
// module.mjs
export default (a, b) => a + b;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.