-
Notifications
You must be signed in to change notification settings - Fork 47
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
[react-sharedb] - Why react-sharedb is throwing error when we use in some ts(TypeScript) file. Is it not supported? #873
Comments
Similar issue is created for next.js. |
Hi @saukumar95, sorry for the late response, 0.29.4 is a pretty old version which might not have an actual TS support tested yet at that point. We did update TS support in the recent versions of startupjs (and react-sharedb), there was also a problem with Can you try generating a new startupjs project and see if you still have this issue. If you don't then I would just recommend to try to update your project to use the latest version of react-sharedb. Otherwise, if you would still see the issue on a freshly generated project then it would help a lot if you can publish the repo to github with this issue replicated and we'll prioritise fixing it. |
@saukumar95 we are also using Webpack 5 in the latest versions of startupjs and the latest versions of @startupjs/react-sharedb seem to be working fine with it in TS files. I'm not sure it works correctly on Webpack 4 though since we had to do some changes to our module imports/exports when transitioning to Webpack 5 and when we were adding support for |
And I'm also not sure with the opposite scenario -- the older versions of startupjs (including react-sharedb) were made for and tested on Webpack 4 and might not work on Webpack 5 at all correctly without tweaks. |
Thanks! for the update @cray0000. Let me check after upgrade. I hope this will work. As I would love to publish the repo and get help but unfortunately that private repo and not open source project. So that's not in my control. 😁😉. But thanks for your support. |
@cray0000 i tried upgrading and i noticed there is no issue with startupjs. It's actually the webpack configuration causing issue which need to be fixed. Thanks for helping. |
For any JS or JSX file I have used it is working fine but I am not able to understand such behavior in below scenario :
JS <- react-sharedb -> working fine.
JS <- JS <- react-sharedb -> working fine.
JSX <- JSX/JS <- react-sharedb works fine.
JS <- TS <- react-sharedb -> Not working
Issue is when I create one helper JS file which contains react-sharedb import and then I import that helper file in TS file.
Webpack compiler then tries to compile but later it throws below error:
Error [ERR_REQUIRE_ESM] [ERR_REQUIRE_ESM]: Must use import to load ES Module:
Node Version : 14.16.1
Webpack Version: 5.36.2
React version: 17.0.1
@startupjs/react-sharedb version: 0.29.4
The text was updated successfully, but these errors were encountered: