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' #84

Closed
MrArun005 opened this issue Jul 2, 2022 · 6 comments
Closed

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

MrArun005 opened this issue Jul 2, 2022 · 6 comments

Comments

@MrArun005
Copy link

After installing npm mjml-react and when i try to import any element such as import {mjml} from 'mjml-react'. it is throwing an error which says "Module not found : Can't resolve 'fs' ". Please guide me through on how to render in inside my NGINX web application.

@daliusd
Copy link
Contributor

daliusd commented Jul 2, 2022

You should give more context. Is your application working in other environments?

@MrArun005
Copy link
Author

should
i have developed a NGINX web application, where i have email gateway which is now basically supports HTML emails and plain emails. Now keeping an eye on future i want to implement mjml-react library also in my project after installing npm mjml-react. when i try to use any elements from that library im facing a problem, Module not found : can't resolve 'fs' and My application is working completely fine.

@daliusd
Copy link
Contributor

daliusd commented Jul 3, 2022

Have you followed instructions and installed both mjml-react and mjml ? Do you have minimal reproducible case where mjml-react is not working for you?

@MrArun005
Copy link
Author

Yes, I have installed both the library namely mjml-react and mjml. I am writing a component that, I can export (named export) into my main index.js as a result its throwing errors, which are

Can't resolve 'url'
Can't resolve 'fs'
Can't resolve 'path'
Can't resolve 'crypto'
Can't resolve 'os'

@daliusd
Copy link
Contributor

daliusd commented Jul 4, 2022

This is core node libraries. I assume they can be unresolved only if you are doing something for browser. Then look for ideas #52

In the end it is not problem with the library. I am closing this issue now. Please return with working reproducible example if you want to reopen it.

@daliusd daliusd closed this as completed Jul 4, 2022
@pachuka
Copy link

pachuka commented Aug 17, 2022

@daliusd - I know you've closed this ticket as resolved due to core node libraries being used and I get that, but I do think its worth a discussion.

Being able to use react-mjml in a browser enviornment only breaks after the minify changes were introduced in the latest release (fine in 2.0.7, doesn't work in 2.0.8) as part of #75.

In my opinion, leave minification up to the consumers of the application, if folks are working with React they most likely have some sort of bundling tooling in place already such as rollup/webpack/etc. where they can minify the output however they want.

Otherwise at least make it opt-in, update it to be a peer dep and as of NPM7 we can annotate those to optional, then enable minification if that peer dep is included. That allows you to have minifcation and still continue to support those browser use cases.

Thanks!

EDIT: This did end up being a breaking change for us so it coming through as a patch semver change wasn't great for automatic dependency management

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

3 participants