Skip to content

Instantly share code, notes, and snippets.

@kikill95
Last active April 5, 2017 07:01
Show Gist options
  • Save kikill95/7c1c2411b93e64097c46b247b264c3a1 to your computer and use it in GitHub Desktop.
Save kikill95/7c1c2411b93e64097c46b247b264c3a1 to your computer and use it in GitHub Desktop.
js modules, do you understand following:
// imports es6
import defaultMember from "module-name";
import * as name from "module-name";
import { member } from "module-name";
import { member as alias } from "module-name";
import { member1 , member2 } from "module-name";
import { member1 , member2 as alias2 } from "module-name";
import defaultMember from "module-name";
import defaultMember, * as name from "module-name";
import "module-name";
// exports es6
export { name1, name2, …, nameN };
export { variable1 as name1, variable2 as name2, …, nameN };
export let name1, name2, …, nameN; // also var
export let name1 = …, name2 = …, …, nameN; // also var, const
export expression;
export default expression;
export default function (…) { … } // also class, function*
export default function name1(…) { … } // also class, function*
export { name1 as default, … };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment