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

NodeJS https module dependency in latest version #67

Closed
jz222 opened this issue Sep 24, 2022 · 5 comments
Closed

NodeJS https module dependency in latest version #67

jz222 opened this issue Sep 24, 2022 · 5 comments
Labels
dependencies Pull requests that update a dependency file wontfix

Comments

@jz222
Copy link

jz222 commented Sep 24, 2022

Hi,

thanks for this package.

I'm using it in a React app with the standard create-react-app config. Since version v2.2.1 of browser-image-resizer, the React app doesn't compile with the following error:

ERROR in ./node_modules/browser-image-resizer/dist/index.js 3476:52-72

Module not found: Error: Can't resolve 'https' in '/Users/user/dev/frontend-futura/node_modules/browser-image-resizer/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
	- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "https": false }

I understand the error and know how to fix it, but I was wondering if it's necessary to have this https depedency that requires me to add a polyfill.

Thanks for your time

@ericnograles
Copy link
Owner

Hi @jz222 as the error message states, the package uses Webpack 4.x so by default it includes the https polyfill. I'll see how big of a lift it is to go to webpack 5.x.

ericnograles added a commit that referenced this issue Sep 24, 2022
- also added CRA for react testing in repo
@ericnograles
Copy link
Owner

Was able to bump to Webpack 5 with minimal drama, will deploy a 2.4.x line of the library with this change and hopefully that gets rid of that error in CRA, I will do a manual test after to verify.

ericnograles added a commit that referenced this issue Sep 24, 2022
* #67 - webpack 4 to 5, should get rid of https module
- also added CRA for react testing in repo

* bumps webpack-cli@latest
@ericnograles
Copy link
Owner

So bad news here, exif-reader injects these Node modules by default, so we're getting caught in the blast radius here. As a workaround, add https, http, and fs polyfills in your CRA. Sorry for the inconvenience!

@ericnograles ericnograles added wontfix dependencies Pull requests that update a dependency file labels Sep 24, 2022
@ericnograles
Copy link
Owner

ericnograles commented Sep 25, 2022

@jz222 so great news, because we were able to nuke the exifreader dependency, this is no longer an issue. Please install 2.4.0 from npm and you should be all set -- see PR #70

Thanks!

@jz222
Copy link
Author

jz222 commented Sep 25, 2022

Thanks a lot for the update, it works fine now.

@jz222 jz222 closed this as completed Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file wontfix
Projects
None yet
Development

No branches or pull requests

2 participants