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 2.0.0-beta.5 isn't visible on npmjs #511

Closed
asadsahi opened this issue Sep 15, 2016 · 38 comments
Closed

angularfire2 2.0.0-beta.5 isn't visible on npmjs #511

asadsahi opened this issue Sep 15, 2016 · 38 comments

Comments

@asadsahi
Copy link

It is self evident if you try to install this version or search on npmjs.com.

@jwuliger
Copy link

Yes please release it. We need it badly for our project. Thanks!!

@davideast
Copy link
Member

@asadsahi @jwuliger There's an issue with AoT compilation that we are looking into. Rest assured we are working on it :)

@jwuliger
Copy link

@davideast Thanks David!

@asadsahi
Copy link
Author

asadsahi commented Sep 15, 2016

@davideast should angularfire 2 be worried about AoT right now when tooling like cli / official documentation doesn't give any clue to what AoT is? To most of us this is just a concept in the air right now.

@ivoviz
Copy link
Contributor

ivoviz commented Sep 15, 2016

@asadsahi Getting AoT working is not really a big deal even on a CLI made project, and I'm actually waiting for angularfire2 to work with AoT. Also the latest release isn't really a deal breaker, one could just use rxjs beta.10 until it's released, but AoT is something that should definitely work now that Angular 2.0.0 is released and I'm really glad they're working on it!

@asadsahi
Copy link
Author

@ivoviz AoT definitely sounds good, its just frustration caused by last release of angularfire2 could be avoided by a subsequent release targeting AoT. Not sure if the priority was to fix critical issues than AoT.

@ivoviz
Copy link
Contributor

ivoviz commented Sep 15, 2016

@asadsahi Imo they just forgot to release initially and later on found an issue with AoT. Probably they'll fix it soon and then do a release. I understand your frustration, but the lib - with a small modification - still works, so I wouldn't really sweat it. Let's hope they'll do a release soon with AoT fixes though!

@davideast
Copy link
Member

@asadsahi @ivoviz It's important that we try not to knowingly release bugs into production. Outside of the AoT issue we have some more testing to do as there were a fair amount of changes to our test setup from the RC7 upgrade.

We plan on cutting a next release soon, we'll let you know when it's out.

@jeffbcross
Copy link
Contributor

Hey folks, I've published a pre-release version of the package behind a tag. It includes some packaging changes introduced in #510 which haven't yet been merged into master. You can get it by npm install angularfire2@next.

I'd appreciate any feedback if there are issues with the new packaging.

@jeffbcross
Copy link
Contributor

Sorry for the inconvenience, I pushed the beta.5 tag to Github as I was preparing to do the release, and then ran into some build issues. As I was correcting the build issue, I wanted to take care of a couple of things to make AngularFire2 AoT-compile-friendly.

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

@jeffbcross Thanks! I've just tried it, it's still not working for AoT, but at least it's a new error now. Previously I had Could not resolve 'angularfire2' from .../src/app/app.module.js, now it's Could not resolve '_stream_writable' from .../node_modules/angularfire2/node_modules/firebase/database-node.js

@jeffbcross
Copy link
Contributor

Thanks, will look into it. We should add an AoT integration test (though
not necessarily block this release on it).
On Thu, Sep 15, 2016 at 5:51 PM John Smith [email protected] wrote:

@jeffbcross https://github.com/jeffbcross Thanks! I've just tried it,
it's still not working for AoT, but at least it's a new error now.
Previously I had Could not resolve 'angularfire2' from
.../src/app/app.module.js, now it's Could not resolve '_stream_writable'
from .../node_modules/angularfire2/node_modules/firebase/database-node.js


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#511 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAcTV2q5jLE1EE5NEepMiQgGNMSJl_hQks5qqef0gaJpZM4J-QeS
.

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

Just to be sure I'm doing it right, my rollup config is something like this:

export default {
  entry: 'src/main.js',
  dest: 'dist/build.js',
  sourceMap: false,
  format: 'iife',
  plugins: [
      nodeResolve({jsnext: true, module: true}),
      commonjs({
        include: ['node_modules/rxjs/**', 'node_modules/angularfire2/**'],
      }),
      uglify()
  ]
}

@asadsahi
Copy link
Author

asadsahi commented Sep 16, 2016

@jeffbcross latest preview package has fixed #496 at least 👍

Here are my packages:

   "angularfire2": "^2.0.0-beta.5-preview",
    "firebase": "3.4.0",
    "rxjs": "^5.0.0-beta.12",
    "zone.js": "^0.6.23"

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

@jeffbcross It's just a wild guess, but it seems like it's trying to load the node version of firebase (firebase-node) instead of the browser one (firebase-browser).

@davideast
Copy link
Member

@ivoviz Upgrading to Firebase 3.4.0 this might fix issue. Which we can do now that we're off SystemJS.

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

@davideast Doesn't seem to do the trick, at least for me. Upgraded firebase to 3.4.0 both in my app and in angularfire2 itself, but still the same error.

@jeffbcross
Copy link
Contributor

@ivoviz can you add browser: true to nodeResolve options like so?

nodeResolve({jsnext: true, module: true, browser: true})

@jeffbcross
Copy link
Contributor

^^^ that's because Firebase's package.json has a browser field pointing to the correct file for browser use. Rollup-plugin-node-resolve sets browser to false by default.

It also may be necessary to add firebase to the include of the commonjs plugin.

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

@jeffbcross Thanks for the tip! Adding browser: true gets me to a new error: Module .../node_modules/angularfire2/node_modules/firebase/firebase.js does not export initializeApp (imported by .../node_modules/angularfire2/angularfire2.js). Tried to add firebase to commonjs plugin, doesn't help.

@jeffbcross
Copy link
Contributor

@ivoviz can you share your complete configuration again?

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

rollup

import rollup from 'rollup';
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';

export default {
  entry: 'src/main.js',
  dest: 'dist/build.js', // output a single application bundle
  sourceMap: false,
  format: 'iife',
  plugins: [
    nodeResolve({ jsnext: true, module: true, browser: true }),
    commonjs({
      include: [
        'node_modules/rxjs/**',
        'node_modules/angularfire2/**',
        'node_modules/firebase/**'
      ],
    }),
    uglify()
  ]
}

tsconfig

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "typeRoots": [
      "../node_modules/@types"
    ],
    "types": [
      "jasmine",
      "firebase",
      "hammerjs",
      "core-js"
    ]
  },

  "files": [
    "app/app.module.ts",
    "main.ts",
    "typings.d.ts"
  ],

  "angularCompilerOptions": {
   "genDir": "../aot",
   "skipMetadataEmit" : true
 }
}

Using angularfire2 next (or beta.5-preview)

@jeffbcross
Copy link
Contributor

@ivoviz could you try changing the commonjs firebase include line to node_modules/angularfire2/node_modules/firebase/**?

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

Same error sadly.

@jeffbcross
Copy link
Contributor

@davideast is there a change in packaging with 3.4.0 that might cause this issue?

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

Just fyi, I'm pretty sure it was happening with 3.3.0/3.3.2 as well.

@jeffbcross
Copy link
Contributor

@ivoviz could you share your whole project in a github repository so I could tinker with it?

@ivoviz
Copy link
Contributor

ivoviz commented Sep 16, 2016

Sent an invite, it's in the aot branch.

@jeffbcross
Copy link
Contributor

@ivoviz can you hop on Gitter?

@jeffbcross
Copy link
Contributor

TL;DR we worked around the rollup issue using namedExports, to work around rollup-commonjs plugin's lack of understanding re-exported symbols.

namedExports: {
        'node_modules/firebase/firebase.js': ['initializeApp', 'auth', 'database']
      }

rollup/rollup-plugin-commonjs#35

In other news, I've pushed the latest release to npm at latest tag, so you can get it by installing angularfire2@latest or [email protected].

@eusthace811
Copy link

Where should I include the named exports?

I am having the same issue in Ionic 2 RC0....

Any help?

@ivoviz
Copy link
Contributor

ivoviz commented Sep 28, 2016

@jlsuarezs Read #545 (comment), might help you out.

@eusthace811
Copy link

eusthace811 commented Sep 28, 2016

Thank you for your help @ivoviz !

But now I have I new issue:

rollup: Use of `eval` (in /Users/me/project/node_modules/angularfire2/node_modules/firebase/firebase.js) is strongly    discouraged, as it poses security risks and may cause issues with minification. See https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval for more details 

@ivoviz
Copy link
Contributor

ivoviz commented Sep 28, 2016

You can ignore that imo.

@eusthace811
Copy link

It's not building the bundle, so, I've removed the evals from firebase.js and now! No errors, but a new issue :S:

Uncaught TypeError: Cannot read property 'navigator' of undefined

It's because of the use strict mode, anyway to remove the strict mode only for firebase in the rollup config? :(

@eusthace811
Copy link

eusthace811 commented Sep 28, 2016

If I add the option: useStrict: false, to the rollup.config.js it works, but I think it's not the best option....

Any idea?

@chrste90
Copy link

I have the same problem. Where did you put the useStrict: false option in rollup.config.js?

@chrste90
Copy link

Ah, nevermind, just a little typo, now it works. Thanks!

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

7 participants