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

Polyfills or fallbacks for browser use with Webpack 5 #237

Closed
ahocevar opened this issue Sep 10, 2021 · 4 comments
Closed

Polyfills or fallbacks for browser use with Webpack 5 #237

ahocevar opened this issue Sep 10, 2021 · 4 comments

Comments

@ahocevar
Copy link
Contributor

When compiling an application that depends on geotiff.js with Webpack 5, Webpack complains about missing poyfills or fallbacks for http, https, fs and url.

For fs it should be 100% safe to add a fallback. For http, https and url, a polyfill might be required, depending on if/how it is used in a browser environment. I have not checked that though.

Assuming a fallback is fine for all these dependencies, it would be sufficient to add the following to package.json:

"browser": {
  "fs": false,
  "http": false,
  "https": false,
  "url": false
} 

This is related to #98.

The issue came up in openlayers/openlayers#12729.

A dependency of geotiff.js, readable-stream, has the same problem. See nodejs/readable-stream#448 for the ticket there, which also helps a bit in understanding the problem.

@ahocevar ahocevar changed the title Polyfills or fallbacks for browser use Polyfills or fallbacks for browser use with Webpack 5 Sep 10, 2021
@kasugaiasuka
Copy link

Is #234 also relevant?

@ahocevar
Copy link
Contributor Author

ahocevar commented Sep 17, 2021

@kasugaiasuka Oh yes, #234 will probably fixe this issue. Thanks for reporting that!

thomasleese added a commit to ministryofjustice/hmpps-book-secure-move-frontend that referenced this issue Sep 22, 2021
This fixes an issue with ol 6.7 which uses geotiff.

See
openlayers/openlayers#12729 (comment)
for the suggested fix and
geotiffjs/geotiff.js#237 for the original
problem.
@Morgul
Copy link

Morgul commented Sep 23, 2021

I can confirm that version 1.0.6 fixes my project that's using vite and openlayers (and geotiff as a dependency of openlayers). Just ran into this yesterday, so it's wonderful to see the fix land already.

@constantinius
Copy link
Member

@ahocevar I think we can close this issue, right?

@ahocevar ahocevar closed this as completed Oct 7, 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

4 participants