-
Notifications
You must be signed in to change notification settings - Fork 164
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
Issues with webpack 5 #502
Comments
Hey, @jhammond2012 thank you for raising this issue. The error seems to be thrown from the dependencies related to the Starting from The way to add this fallback is different in all major Frameworks, Which framework are you using? |
I have a similar problem. First buffer is missing. If I supply it by adding a polyfill in the vite config, there is a "redeclaration of import process" error. I noticed these 2 lines in
Seems like process and buffer are treated differently. |
As mentioned above these new versions of popular bundlers (webpack 5, rollup, vite etc) don't import by default server-side node.js modules into SPA or in browser (client-side) for example there's no
Where did you see these lines we don't have such code in the source code of the The process for adding the polyfill depends on the bundler and/or the framework you use. Could you provide us with a demo where you can reproduce this error? |
@kujtimprenkuSQA Maybe the vite plugin (@esbuild-plugins/node-globals-polyfill) has already interfered there and produced these lines. Damn, for me that's a real hurdle on my way of integrating wallet-selector. I'm stuck for a few days. |
The thing is, polyfilling buffer seems to work fine. I'm achieving this by adding the following to my vite.config.ts
But then, the the "redeclaration of import process" comes along. Ha, I'll try to reproduce this situation in a minimal example. |
Hey, @felixniemeyer I have created a “demo” copy of guest-book with NEAR Wallet Selector support this demo I solve these issues:
The demo is in my personal github account: I haven’t written Vue apps in almost 2 years so forgive me if the code looks not that good i tried to keep it clean though. Please check the commits history on that demo I separated commits in places I fix issues. Later on the day I will figure it out on how to properly deploy this demo in gh-pages. |
Awesome, thanks for your support, I'll try it out on my system in a minute. In the meantime, I have created a new vite project with yarn create vite and added dependencies and the near-wallet.js file as described in the near docs https://docs.near.org/develop/integrate/frontend. I ran into the same polyfill problems as described above. You can see it in this reo https://github.com/felixniemeyer/vite-near-wallet-vite-error-reproduction/commits/main I will now start comparing our repos and see what's the difference in order to fix the issue in my original project. Thanks for the support 👍 |
Ok, great, I managed to provide buffer and process in a Vite project (not Webpack 5) by:
|
@felixniemeyer, you're right the above I am not sure about the original issue related to webpack 5 because I don't have enough info on which framework @jhammond2012 is using. |
Just a quick update, I finally managed to successfully publish the above demo via gh-pages: https://kujtimprenkusqa.github.io/guest-book-vue/ For some reason, with Vite 3 the build would run just fine but when deployed or run in the preview it would throw an error: The solution/workaround was found here: This is the commit in which I fixed this kind of issue (check |
I am facing an issue with web pack v5 and buffer. I am getting the following error:
Based on some good ol' Googling, I came across this suggestion but it did not seem to help.
-> webpack.config.js
The text was updated successfully, but these errors were encountered: