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

Warning: Module 'cross-fetch/polyfill' Not ESM in Angular Build #1269

Open
Shamshiel opened this issue Dec 14, 2023 · 2 comments
Open

Warning: Module 'cross-fetch/polyfill' Not ESM in Angular Build #1269

Shamshiel opened this issue Dec 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Shamshiel
Copy link

Description:
During the Angular build process, a warning is issued regarding the module cross-fetch/polyfill being used by node_modules/meilisearch/dist/bundles/meilisearch.esm.js.

Expected Behavior:
The expectation is that meilisearch.esm.js is compliant with ESM standards.

Current Behavior:
Currently, the module cross-fetch/polyfill appears to be either a CommonJS or AMD module, which could potentially cause optimization bailouts and hinder the build performance. The specific warning is as follows:

▲ [WARNING] Module 'cross-fetch/polyfill' used by 'node_modules/meilisearch/dist/bundles/meilisearch.esm.js' is not ESM. CommonJS or AMD dependencies can cause optimization bailouts.

Environment:

  • instant-meilisearch version: v1.0.0
@flevi29
Copy link
Collaborator

flevi29 commented Dec 16, 2023

This is a cross-fetch issue. Doesn't directly support ESM, in fact even uses an older node-fetch because latest is ESM only, at some point might even stop getting security updates (if it didn't already). Not sure how much this impacts tree shaking on browser builds or if it matters at all.

@flevi29
Copy link
Collaborator

flevi29 commented Dec 17, 2023

There are a few issues related to ESM on cross-fetch. These are not getting fixed, I don't think so. Package is not very active, questionably maintained. We have three options:

  • keep using cross-fetch despite this
  • switch to axios or something similar (that would mean no support for deno theoretically as it doesn't implement XHR, however I'm not sure how they solve this with node compat)
  • use proper fetch, since everything in maintenance or LTS supports it at this point (this would mean dropping support for end of life decade old browsers and runtimes)

@curquiza curquiza added the bug Something isn't working label Jan 3, 2024
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