Skip to content

Creating token with metaplex causing bug with webpack #249

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

Closed
The-x-35 opened this issue Jan 29, 2025 · 16 comments
Closed

Creating token with metaplex causing bug with webpack #249

The-x-35 opened this issue Jan 29, 2025 · 16 comments
Labels
bug Something isn't working

Comments

@The-x-35
Copy link
Contributor

Describe the bug
While trying to launch a token with metaplex on webpack shows error of fs and os dependencies not found, even when they are added. This seems to be an issue with webpack only and ignoring them wont work.

To Reproduce
Steps to reproduce the behavior:
try to launch a token with metaplex on webpack on a browser.

Expected behavior
I expected it to launch token.

Screenshots
NA

Additional context
NA

@The-x-35 The-x-35 added the bug Something isn't working label Jan 29, 2025
@michaelessiet
Copy link
Member

Hi @The-x-35 , please can you share a SS of the error messages you're getting. I would like to pinpoint the particular metaplex package causing the error

@The-x-35
Copy link
Contributor Author

The-x-35 commented Feb 1, 2025

@michaelessiet its not really a metaplex error but fs and os modules dont work well with webpack
u can check the issue here
https://stackoverflow.com/questions/39249237/node-cannot-find-module-fs-when-using-webpack/51669301#51669301

we cant really ignore them as then the metaplex wont work.

@michaelessiet
Copy link
Member

I'm assuming that metaplex isn't compatible on the web/browser then? fs and os are nodejs primitives and are not available in the browser unless through polyfills

@The-x-35
Copy link
Contributor Author

The-x-35 commented Feb 3, 2025

@michaelessiet Yes sir you are correct. We need to find a way to deploy tokens without them.

@michaelessiet
Copy link
Member

Alright. Will take this up after our plugin architecture migration

@The-x-35
Copy link
Contributor Author

The-x-35 commented Feb 4, 2025

@michaelessiet yeah sure.

@michaelessiet
Copy link
Member

Hey @The-x-35 do you know which metaplex package depends on fs and os?

@The-x-35
Copy link
Contributor Author

@michaelessiet sir i am not sure, but as far as i know metaplex makes a json file and adds token metadata there and then sends it on chain. So in creating the json file and editing metadata these packages would be used

@michaelessiet
Copy link
Member

Ok, thank you

@michaelessiet
Copy link
Member

@The-x-35 have you tried any of these solutions to see if they work? https://stackoverflow.com/questions/39249237/node-cannot-find-module-fs-when-using-webpack

@The-x-35
Copy link
Contributor Author

The-x-35 commented Mar 4, 2025

yeah @michaelessiet i tried them, compiling node separately cant be a soln for me as my site is completely client side, and i cant ignore them as they are core requirements.
I am in talks with Metaplex team and am currently working on this, if i find a fix i will inform you.

@The-x-35
Copy link
Contributor Author

The-x-35 commented Mar 6, 2025

Hey @michaelessiet
I found out that you'll need to roll back on 0.9.x for

  • umi
  • umi bundle defaults
  • toolbox
  • any uploaders you might be using.
    This worked for me, and was suggested my the Metaplex team

@michaelessiet
Copy link
Member

Hey @The-x-35 have you tried the latest version of v2 with webpack and adding the @solana-agent-kit/plugin-nft to the list of externals?

@The-x-35
Copy link
Contributor Author

@michaelessiet not yet, will try soon

@andredcoli
Copy link

im also getting multiple 'fs' issues when building with next, this applies for multiple dependancies too but seems like it's mostly wallet provider packages like coral xyz

@michaelessiet
Copy link
Member

Yes. Coral-xyz is not currently compatible with webpack. Reference the readme here https://www.npmjs.com/package/@coral-xyz/anchor.

Closing this issue as it is an issue with coral xyz not being compatible with webpack. This issue however can be fixed using node polyfills however it takes a lot of tinkering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants