angulartics / angulartics2

Vendor-agnostic analytics for Angular2 applications.
MIT License
1.01k stars 193 forks source link

Uncaught TypeError: ReplaySubject is not a constructor #142

Open devonsams opened 7 years ago

devonsams commented 7 years ago

Note: for support questions, please use one of these channels: Chat: Gitter

Getting an error in my production build:

Uncaught TypeError: ReplaySubject is not a constructor
    at new Angulartics2 (app.js?1502845560439:1)
    at _createClass (app.js?1502845560439:1)
    at _createProviderInstance$1 (app.js?1502845560439:1)
    at initNgModule (app.js?1502845560439:1)
    at new NgModuleRef_ (app.js?1502845560439:1)
    at Object.createNgModuleRef (app.js?1502845560439:1)
    at NgModuleFactory_.create (app.js?1502845560439:1)
    at app.js?1502845560439:1
    at ZoneDelegate.invoke (shims.js?1502845560439:404)
    at Object.onInvoke (app.js?1502845560439:1)
Angulartics2 @ app.js?1502845560439:1
_createClass @ app.js?1502845560439:1
_createProviderInstance$1 @ app.js?1502845560439:1
initNgModule @ app.js?1502845560439:1
NgModuleRef_ @ app.js?1502845560439:1
createNgModuleRef @ app.js?1502845560439:1
NgModuleFactory_.create @ app.js?1502845560439:1
(anonymous) @ app.js?1502845560439:1
ZoneDelegate.invoke @ shims.js?1502845560439:404
onInvoke @ app.js?1502845560439:1
ZoneDelegate.invoke @ shims.js?1502845560439:403
Zone.run @ shims.js?1502845560439:154
NgZone.run @ app.js?1502845560439:1
PlatformRef_._bootstrapModuleFactoryWithZone @ app.js?1502845560439:1
PlatformRef_.bootstrapModuleFactory @ app.js?1502845560439:1
(anonymous) @ app.js?1502845560439:1
a @ app.js?1502845560439:1
u @ app.js?1502845560439:1
(anonymous) @ app.js?1502845560439:1
(anonymous) @ app.js?1502845560439:1
(anonymous) @ app.js?1502845560439:1
(anonymous) @ app.js?1502845560439:1

I'm using the following seed: https://github.com/mgechev/angular-seed I can follow up with a repo demonstrating the error if necessary

all

devonsams commented 7 years ago

I'm seeing in my build that this section is getting jumbled up. I'm still trying to figure out why though:

var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(1),
    __WEBPACK_IMPORTED_MODULE_1_rxjs_ReplaySubject__ = (__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__), __webpack_require__(19)),
    __WEBPACK_IMPORTED_MODULE_2__angular_common__ = (__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_ReplaySubject__), __webpack_require__(3)),
    __WEBPACK_IMPORTED_MODULE_3__angular_router__ = (__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__angular_common__), __webpack_require__(5)),
    __WEBPACK_IMPORTED_MODULE_4_rxjs_add_operator_filter__ = (__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_router__), __webpack_require__(20));
__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_rxjs_add_operator_filter__);
__webpack_require__.d(__webpack_exports__, "a", function() {
    return Angulartics2
});

edit: this isn't the problem.

devonsams commented 7 years ago

I was using systemjs-builder 0.16.9 and downgraded to 0.15.34 and it fixed the problem. It might have something to do with this open issue: https://github.com/systemjs/systemjs/issues/1587

ZuSe commented 7 years ago

I can confirm this. There seems to be real issues when using SystemJS 0.20.x . I have pushed a very minimal seed-project with angulartics here:

https://github.com/ZuSe/angular2-seed/tree/test/angulartics2

But i only run into the issue when compiling aot.

scttcper commented 6 years ago

I think there was some issues with older version of rxjs and older versions of systemjs. Let me know if this can be closed.