Currently, I am incorporating a library into my TypeScript 4 Web Component and utilizing it as shown below:
import { connect } from '@captaincodeman/redux-connect-element';
export class AppRouterElement extends connect(store, LitElement) {....}
After building the project with Yarn 2 using yarn build
, I encounter an issue at run-time where I see the error:
Uncaught TypeError: Object(...) is not a function
Upon investigating the compiled JavaScript code, I notice the following line of code:
let Sr = class extends (Object(wr.connect) (fn, vr)) {....}
This line appears to be missing a comma. Adding the comma resolves the issue and the application functions correctly. Interestingly, when using Rollup for the build process, no runtime error occurs.
Now, I am unsure which specific WebPack or TSC configurations to modify in order to address this issue. If you have any insights on what this problem could be called or how to troubleshoot it effectively, please let me know.