I have a Stencil component library using @Stencil/redux, redux, redux-observable and redux-actions. Everything worked fine before but I'm trying to upgrade to Stencil@One (1.0.0-beta.5).
I have now an error during the Redux store creation. This is my store configuration :
import { Store, createStore, applyMiddleware } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import { rootEpic } from './epic';
const epicMiddleware = createEpicMiddleware();
export const ogodStore: Store<OgodState> = createStore(rootReducer, applyMiddleware(epicMiddleware));
epicMiddleware.run(rootEpic);
The error occurs on applyMiddleware call and is the following :
TypeError: Class constructor Observable cannot be invoked without 'new'
at new ActionsObservable (chunk-f18fe9c6.js:3744)
at epicMiddleware (chunk-f18fe9c6.js:3830)
at chunk-f18fe9c6.js:4579
at Array.map (<anonymous>)
at chunk-f18fe9c6.js:4578
at createStore (chunk-f18fe9c6.js:4043)
at chunk-f18fe9c6.js:4716
I am so confused over the years by the different javascript module types and targets... But here's what I know :
(ActionsObservable.__proto__ || Object.getPrototypeOf(ActionsObservable)).call(this)
call(this)
to construct a ActionsObservable object, which is dependent on rxjs's Observable
classObservable
from rxjs does not support this ?! It is a class that should be constructed using ES6 syntax new
because it is supported by browsers now ?
I'd really like to know if I should create an issue in redux-observable's Github ?
An issue has been created since nobody answered. Hope we get news on it soon...
I solved this issue following the github link provided by @Elvynia -
Install redux-observable-es6-compat and Import -
import { createEpicMiddleware, combineEpics } from 'redux-observable-es6-compat';
instead of
import { createEpicMiddleware, combineEpics } from 'redux-observable';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With