Skip to content
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

Module not found: Can't resolve 'fs' #25

Closed
prinkpan opened this issue May 9, 2021 · 6 comments
Closed

Module not found: Can't resolve 'fs' #25

prinkpan opened this issue May 9, 2021 · 6 comments

Comments

@prinkpan
Copy link

prinkpan commented May 9, 2021

I did a yarn add ascii-art in my project, added window.art = require('ascii-art'); and tried to build using npm run build but it gives the following error:

Module not found: Can't resolve 'fs' in 'C:....\node_modules\ascii-art-image'

I am not so great with these tools so it can be something at my end that I am doing wrong.

@khrome
Copy link
Owner

khrome commented May 9, 2021

I'll check this out today. There are some upcoming changes to go out, and f there's an issue I'll release a fix with that.

Thanks for the report!

@khrome
Copy link
Owner

khrome commented May 9, 2021

For further detail can you give me your build command? It's very likely you're building for the web and need to exclude node specific modules.

@prinkpan
Copy link
Author

prinkpan commented May 9, 2021

You're right, I'm using this on my web app. Not sure what you mean by build command. I get the said error when I run npm run build. Sorry, I can't give more than this as I'm not so well versed with these tools. Thank you for looking into this.

@khrome
Copy link
Owner

khrome commented May 9, 2021

npm run build executes whatever is in scripts.build in your package.json file, so there's no logic explicitly tied to that... it's wired individually for every module in your package.json.

You probably used a boilerplate generator that created this for you, but did not include commonly used configurations for building clientside versions of serverside modules.

likely you just need to tell it to not include fs in the browser... either in the babel config's resolve or in the config of whatever magic you're using on top of it.

@khrome
Copy link
Owner

khrome commented May 13, 2021

Did this get sorted?

@khrome
Copy link
Owner

khrome commented May 16, 2021

I'm going to call this good, reopen if there are issues.

@khrome khrome closed this as completed May 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants