today i have migrated my app from the beta to ionic 2 RC.0.
It looks awesome so far but i use firebase and have a strange issue:
The Error says:
[16:52:39] rollup: Export 'auth' is not defined by '/cms/athl3tics/.tmp/pages/auth/login/login.js'
[16:52:39] rollup: Use of `eval` (in /cms/athl3tics/node_modules/firebase/auth.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
[16:52:39] rollup: Use of `eval` (in /cms/athl3tics/node_modules/firebase/database.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
In my package Json i just used the newest version of firebase: "firebase": "3.4.1",
And i Import firebase with: import * as firebase from 'firebase';
But IntelliJ marked this line already as red, so something is wrong there but iam not sure what it is?
When i do “ionic serve” i get the message in my console: Uncaught TypeError: Cannot read property 'navigator' of undefined
In my case, I’ve found we can modify our rollup config to make it work:
(node_modules/@ionic/app-scripts/config/rollup.config.js)
var ngTemplate = require('../dist/plugins/ng-template').ngTemplate;
var nodeResolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
// https://github.com/rollup/rollup/wiki/JavaScript-API
module.exports = {
/**
* entry: The bundle's starting point. This file will
* be included, along with the minimum necessary code
* from its dependencies
*/
entry: './.tmp/app/main.dev.js',
/**
* sourceMap: If true, a separate sourcemap file will
* be created.
*/
sourceMap: true,
/**
* format: The format of the generated bundle
*/
format: 'iife',
/**
* dest: the output filename for the bundle in the buildDir
*/
dest: 'main.js',
// Add this to avoid Eval errors
useStrict: false,
/**
* plugins: Array of plugin objects, or a single plugin object.
* See https://github.com/rollup/rollup/wiki/Plugins for more info.
*/
plugins: [
ngTemplate(),
commonjs({
include: [
'node_modules/rxjs/**',
'node_modules/angularfire2/**',
'node_modules/moment/**',
'node_modules/@ionic/storage/**'
],
namedExports: {
'node_modules/firebase/firebase.js': ['initializeApp', 'auth', 'database'],
'node_modules/angularfire2/node_modules/firebase/firebase-browser.js': ['initializeApp', 'auth', 'database']
}
}),
nodeResolve({
module: true,
jsnext: true,
main: true,
browser: true,
extensions: ['.js']
})
]
};
this seems like quite the hack, but I guess it is the best we got for now! Integrated basic login functionality… will try some other features, but I really think this, AngularFire2, is still beta and not ready for production code
However if i switch import * as GeoFire from 'geofire'; to import * as GeoFire from 'geofire';
I still get the same error : error TS2307: Cannot find module 'geofire'.
I have the same issue as well. Does that hack method work? or is that not a preferred way to doing things?
Seems like that hack required declaration of each and every firebase func?
‘node_modules/firebase/firebase.js’: [‘initializeApp’, ‘auth’, ‘database’]