'NgReduxModule' is not exported by node_modules/@angular-redux/store/lib/src/index.js error
I'm getting
🚨 'NgReduxModule' is not exported by node_modules/@angular-redux/store/lib/src/index.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
app/app.module.js (21:18)
21: import { NgRedux, NgReduxModule } from "@angular-redux/store";
when compiling with aot compiler:
"aot": "ngc -p tsconfig-aot.json && rollup -c rollup.config.js"
while using 6.2.0-alpha.21 (it is working fine in "6.2.0-alpha.7")
let me know if you need any further details
can you try with 6.2.0?
The alphas are unstable :)
6.2.0 is failing aot compilation for the same reason... 6.2.0-alpha.7 is compiling just fine but I'm also using MockNgRedux.getSelectorStub which seem to be introduced after alpha.7
OK seems you're using rollup - which TBH I haven't tested. I've tested Angular-CLI (which is based on webpack) and SystemJS.
Any chance you could share a repo so I can troubleshoot?
Or at least your tsconfig-aot.json and rollup.config.js?
Here you are: tsconfig-aot.json:-
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"app/app.module.ts",
"app/main-aot.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit": true
}
}
rollup.config.js:-
import nodeResolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import uglify from 'rollup-plugin-uglify'
import angular from 'rollup-plugin-angular';
import replace from 'rollup-plugin-replace'
export default {
entry: 'app/main-aot.js',
dest: 'app_dist/build.js',
sourceMap: true,
format: 'iife',
onwarn: function (message) {
if (/The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten./.test(message)) {
return;
}
},
plugins: [
angular(),
replace({
'process.env.NODE_ENV': JSON.stringify( 'production' )
}),
nodeResolve({jsnext: true, module: true, browser: true}),
commonjs(),
uglify()
]
}
I will set aside some time to dig into this tomorrow. Sorry for the delay.
Yeah OK. Current theory is that it's due to a change in the way we export stuff. We went from this:
import { NgRedux } from './components/ng-redux';
import { DevToolsExtension } from './components/dev-tools';
import { select } from './decorators/select';
import { NgReduxModule } from './ng-redux.module';
export {
NgRedux,
NgReduxModule,
DevToolsExtension,
select,
}
to this:
export * from './components/ng-redux';
export * from './components/dev-tools';
export * from './decorators/select';
export * from './ng-redux.module';
Nicer to code. But it seems according to this that rollup can't handle it without additional config.
I'll try flipping back to the previous style since it was just for convenience.
@slavP can you give 6.2.1-alpha.0 a try and let me know?
@SethDavenport the error has gone. I'm now able to compile successfully. Many thanks!
Great - I will release an official 6.2.1 later today.
6.2.1 released with a fix. Thanks.