Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 5
    Is there any downfall to having a module have individual exports export const myA = 43; export const Something = 44; as well as a export default { myA, Something } ? So when you import you can either import A from './A'; for everything in the module, or import { Something } from './A'; so you only get a some of the module Commented Feb 13, 2017 at 18:41
  • 22
    It is fine, but there is already a syntax for grabbing all named exports into a single object: import * as AllTheThings. Commented Mar 4, 2017 at 12:08
  • 18
    what about this- import 'firebase/storage'; or import 'rxjs/add/operator/map';. What is that actually doing? Commented Sep 24, 2017 at 7:52
  • 23
    @kyw: This executes the module but ignores the exported value. Useful for side effects. Commented Feb 12, 2018 at 2:33
  • 2
    Note: You can't do import { A }; when you did const A = 42; export default A; This might seem weird, and may break your imports when refactoring from named to default exports (unless you remove the curly braces). I guess it's kinda logical though (sigh..), in the sense that default exports only export a value, not a name. The export default A only refers to the value 42 referenced by A. Commented Mar 5, 2018 at 20:14