I’ve made changes to all these files: rollup.config.js, tsconfig.json, app.module.ts
And just importing MomentModule leads to a rollup error
import {MomentModule} from 'angular2-moment';
rollup: Export ‘MomentModule’ is not defined by ‘c:\Ionic\XXX.tmp\app\app.module.ngfactory.js’
bundle prod failed: Module c:\Ionic\XXX\node_modules\angular2-moment\index.js does not export MomentModule (imported by c:\Ionic\XXX.tmp\app\app.module.js)
So I have undone all the changes I did previously and now just doing this:
npm install --save angular2-moment
In app.module.ts: import {MomentModule} from 'angular2-moment'; and adding it to the import array
And this is the rollup error (I’m in rc0 with app-scripts 0.0.30)
rollup: Export ‘MomentModule’ is not defined by ‘c:\Ionic\XXXrc0.tmp\app\app.module.ngfactory.js’
bundle prod failed: Module c:\Ionic\XXXrc0\node_modules\angular2-moment\index.js does not export MomentModule (imported by c:\Ionic\XXXrc0.tmp\app\app.module.js)
Error: Module c:\Ionic\XXXrc0\node_modules\angular2-moment\index.js does not export MomentModule (imported by c:\Ionic\XXXrc0.tmp\app\app.module.js)
at Module.trace (c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:7706:29)
at ModuleScope.findDeclaration (c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:7329:22)
at Scope.findDeclaration (c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:5349:39)
at Identifier.bind (c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:6497:29)
at c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:5149:50
at ArrayExpression.eachChild (c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:5163:19)
at ArrayExpression.bind (c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:5149:7)
at c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:5149:50
at Node.eachChild (c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:5166:5)
at Node.bind (c:\Ionic\XXXrc0\node_modules\rollup\dist\rollup.js:5149:7)
Error running ionic app script “build”: Error: Module c:\Ionic\XXXrc0\node_modules\angular2-moment\index.js does not export MomentModule (imported by c:\Ionic\XXXrc0.tmp\app\app.module.js)
I’ve changed my rollup.config.js for firebase and angularfire2:
// Add this to avoid Eval errors & Uncaught TypeError: Cannot read property 'navigator' of undefined
useStrict: false,
/**
* plugins: Array of plugin objects, or a single plugin object.
* See https://github.com/rollup/rollup/wiki/Plugins for more info.
*/
plugins: [
builtins(),
commonjs({
include: [
'node_modules/rxjs/**',
'node_modules/firebase/**',
'node_modules/angularfire2/**',
],
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']
}),
globals(),
json()
]
};
if (process.env.IONIC_ENV == 'prod') {
// production mode
rollupConfig.entry = '{{TMP}}/app/main.prod.ts';
rollupConfig.sourceMap = false;
}
module.exports = rollupConfig;