Skip to content

update documentation to show the correct import syntax #1274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 18, 2018
Merged

Conversation

Feiyang1
Copy link
Member

@Feiyang1 Feiyang1 commented Oct 2, 2018

import firebase from 'firebase'

doesn't work with the typings we currently have. It works with vanilla javascript though. But to keep it consistently across javascript and typescript, I'm updating it to

import * as firebase from 'firebase'

@@ -83,7 +83,7 @@ var app = firebase.initializeApp({ ... });
If you are using ES6 imports or TypeScript:

```
import firebase from 'firebase';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's another instance (import firebase from 'firebase/app') that should be updated too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! done.

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, LGTM.

@mikelehen mikelehen assigned Feiyang1 and unassigned mikelehen Oct 2, 2018
@mikelehen
Copy link
Contributor

Oh, hrm. Based on #1206 (comment) I guess this change isn't entirely a slam dunk (it'll break people targeting node)? I'm guessing it's still an improvement (I suspect browser usage is much more common), but maybe @jamesdaniels will want to weigh in on what we should be documenting here. Maybe we should describe both syntaxes and when to use each or something.

@Feiyang1
Copy link
Member Author

Feiyang1 commented Oct 2, 2018

Good point. It's a problem when people tries to use native es6 module in node. Native es6 module support in node is still experimental and is hidden behind a flag, so it's probably a rare use case. Anyway, I only updated the section for browser use cases, and in node use case, we only advise to use require() syntax, so we are not misleading people hopefully.
I don't think we need to, but I added a section to explain the native es6 module use case in node. @mikelehen, @jamesdaniels if you think it adds confusion, I will remove it.

@mikelehen
Copy link
Contributor

I'll let James weigh in as he's much more familiar with the nuances here. 😁

@Feiyang1
Copy link
Member Author

@jamesdaniels Are you okay with the change?

@jamesdaniels
Copy link
Member

LGTM.

Sorry I've not had the time to dig in a bit more here. This seems to be the most consistent for the moment.

@Feiyang1 Feiyang1 merged commit 51c87a2 into master Oct 18, 2018
@firebase firebase locked and limited conversation to collaborators Oct 15, 2019
@hsubox76 hsubox76 deleted the update-doc branch September 15, 2020 16:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants