Skip to content
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

AngularFire2 worked even though I've forgotten to add it in vendor.ts #521

Closed
bogacg opened this issue Sep 17, 2016 · 5 comments
Closed

Comments

@bogacg
Copy link

bogacg commented Sep 17, 2016

Hi;
I'm using webpack and AngularFire2 in my project.
Even though I've forgotten to add import statement for angularfire2 and firebase in vendor.ts, my app worked.
Shouldn't app be broken unless we add it to?

@bogacg bogacg changed the title AngularFire2 worked even though I've forgot to add it in vendor.ts AngularFire2 worked even though I've forgotten to add it in vendor.ts Sep 17, 2016
@asadsahi
Copy link

I wonder this as well, I suspect, its because of new module system in angular 2. Not sure, lets hear experts :).

@jeffbcross
Copy link
Contributor

Hey @bogacg I don't know enough about your project to know what's happening. I'll close this issue, but if you want to open a new issue with a github repo or something where we could inspect more, feel free!

@asadsahi
Copy link

asadsahi commented Sep 22, 2016

@jeffbcross this repo should illustrate this query I hope, its a cli based project.

If you see this line we are only importing angularfire2 module using typescript/es6 syntax, but in past we have to use import 'angularfire2' in vendor files first.

I think this beavior of not importing 3rd party libraries in vendor files anymore and only importing like es6 syntax applies to all other 3rd party libraries as well (e.g another 3rd party library imported in project is NgbModule from ng-bootstrap).

Correct me if I am wrong, is this because of webpack 2's ability to handle es6 natively that we don't have to import AMD or commonjs like imports anymore?

Another question arose is around how CLI is handling global dependencies as described below (why angularfire2 doesn't have to follow this pattern):

image

@bogacg
Copy link
Author

bogacg commented Sep 22, 2016

@jeffbcross I've seen this problem right after I've added AngularFire2 to a newly created project from: WEBPACK: AN INTRODUCTION
Sure, it may not be an anomaly related to "your" work or AngularFire2, I'd be happy then pass along to Angular 2 project's issues section or Webpack.

@asadsahi
Copy link

asadsahi commented Sep 22, 2016

@bogacg the problem/query mentioned in the title of this issue isn't specific to angularfire2, if you add any other third party library like ng-bootstrap in an angular 2 project and directly start using them in your angular 2 modules, without adding that library in vendor.ts file, you will not see any error.

I think its because of the new way webpack 2 handles dependencies, not sure though, hence raised to @jeffbcross if he can share his experties in this area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants