-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Module parse failed - webpack #652
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
Comments
You need to configure webpack / babel to work with ES2020 standard (this is what we are targeting). I believe webpack is complaining about that optional chaining operator |
@bshyong Were you able to solve it? I'm running into the same issue and I already have this in my tsconfig.json so not sure what else to change.
|
@paintoshi Depending on which tools you use, adding this won't be enough. Usually it is within webpack / babel etc. where you need to add appropriate loaders or plugins to target modern js. Latest versions of more modern tools like vitest / rollup etc. should work by default, I also think latest babel version also works with es2020. |
@iljadaderko Ok thank you for quick reply. The app was created with Create React App, and I have an old react-scripts package, which in turn uses an old babel-loader. Updating it created plenty of other issues in other packages, so I need to look into this more. Probably have to update a lot to get this working. |
Any update with this? |
@Edison4mobile TL;DR fix was to update babel to latest version that supports ES2020 |
I can confirm that it works with the latest The only problem for me is actually updating React in our live platform. It's tremendously complex with all our dependencies. I would not be sad if web3modal worked with lower versions.. |
@paintoshi In theory you should be able to get it working with v4 of create react app if you add babel loaders for some es2020 syntax (which works in v5 as it uses latest babel version I believe), from the top of my head:
|
@0xasimetriq I wonder if that's possible without ejecting the whole thing, which we probably won't do since it's a one-way operation. |
@0xasimetriq Dug some more into this. Everything works while running [email protected] but that may not be an option for some since it requires React v18 which creates a lot of other problems with some dependent libraries (depending on the app). But the problem above can be avoided without upgrading anything and without ejecting the app which cannot be reverted.
Validated running web3modal 2.0 together with old version of create-react-app and [email protected] and [email protected] |
@paintoshi awesome! Ty for the update, also I was under impression that react-scripts respects babel config file even when not ejected, but I guess that is wrong (been a while since I used it). |
Thanks! I just had to remove the |
Describe the bug
I cannot get the latest module to work, is there something I need to do for this to work with webpack?
SDK Version
To Reproduce
Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: