-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot call a class as a function #1311
Comments
Isolated it down to this |
@vaultec81 does the same code work in pure nodejs? Basically wondering if it's somehow due to react? |
@oed Works perfectly fine in nodejs and in webpack dev server, but fails in production build. It's possible this issue is related solely to webpack, but still need a fix for this, especially considering ceramic http-client will likely be used in other projects utilizing webpack/react. Will keep experimenting to see what I can find. |
Ok, weird. @zachferland could you have a look at this when you get a chance? |
Found a work around using https://unpkg.com/[email protected]/dist/threeid-provider.js in index.html. There are also webpack configuration available at https://github.com/ceramicstudio/js-3id-did-provider/blob/main/webpack.config.js which I have not tested but I would assume it works as the above dist is generated by webpack. |
We just found a fix in the babel config. It requires
References: |
I believe this issue is solved for us. Feel free to close this issue if desired. I do recommended providing webpack/browserified versions of all your modules. |
Finally tracked down, was introduced in https://github.com/ceramicnetwork/js-ceramic/pull/1059/files when adding our own hasInstance implementation for doc(stream)id and commitid and appears to be a bug in babel. Ref (old issue though and not exactly same, but similar) - babel/babel#4452. Fails during runtime at classCallCheck -> https://github.com/babel/babel/blob/be03be1bc3bcfef96ad1c820731d4f7f50d80095/packages/babel-helpers/src/helpers.js Also we have other babel/webpack builds that dont hit this issue, but create react app defaults do. cc @ukstv |
Describe the bug
Cannot call a class as a function while using webpack in production
To Reproduce
Steps to reproduce the behavior:
npm run build
. (Make sure to use production build not webpack dev server, dev server is unaffected)#/links
in browserOptionally you can use the publicly available react example:
Steps:
Expected behavior
No error should be present.
Screenshots
The issue being triggered somewhere inside of the login code above, but due to webpack finding the actual line is tricky.. Will update this issue when I can isolate the exact line of code which is causing this issue
Ceramic versions
Additional context
This issue is not present when using the dev server for webpack/react
Using react-app-rewired
Similar to #1251
The text was updated successfully, but these errors were encountered: