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

chore(headless,bueno): externalize all packages on node outputs #4921

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

louis-bompart
Copy link
Collaborator

@louis-bompart louis-bompart commented Jan 31, 2025

A couple of changes to allow source maps to work properly for our users, and avoid package duplications in bundles:

  • Externalize all dependencies for NPM output
    Stop bundling on NPM. This was an error, causing duplication of heavy libraries such as Redux on customer websites, reducing their overall performance.

  • Merge back conditional exports: we don't need those anymore since the bundling we do not pre-bundle anymore

  • Create a new CDN output that keeps on bundling: Used for our static.cloud.coveo.com shenanigans

  • Update exponential-backoff (some source map fixes)

  • Internalize fetch-event sources with its patch (DXUI ownership for the time being): The lib is unmaintained, and its source maps cause issues; the simpler solution is to absorb it.

    • @ThibautNazare: We discussed this point. To ease the transition, we'll take temporary custody of this piece of code until @coveo/service-core can pick it up.
    • @mmitiche, you worked on the patch about the abort controller, I did include it, but I'd like to know if you have some tips & tricks to validate that all's working A-OK :)
  • Stencil sample required stabilization due to its known deficiencies with modern module resolution.

    • Sadly, we cant change module resolve conditions programmatically yet in a given node process, thus the horrible spawnSync hack.
    • Even the hack cannot handle/overwrite/discard node, so special resolution for this one --> require NodeJS 22.14.0 for module.findPackageJSON

fixes #4883

@louis-bompart louis-bompart requested a review from a team as a code owner January 31, 2025 20:34
@louis-bompart louis-bompart changed the title naive attempt chore(headless,bueno): externalize all packages on node outputs Jan 31, 2025
@louis-bompart louis-bompart marked this pull request as draft January 31, 2025 20:36
Copy link

github-actions bot commented Jan 31, 2025

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 244.2 243.7 -0.2
commerce 355.5 355 -0.1
search 415.5 415 -0.1
insight 406.7 406.2 -0.1
recommendation 256.3 255.9 -0.2
ssr 409.3 408.8 -0.1
ssr-commerce 373.2 372.7 -0.1

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
case-assist 0 6 0
insight 0 27 0
commerce 0 15 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

@louis-bompart
Copy link
Collaborator Author

louis-bompart commented Feb 3, 2025

Todo:

  • creates dedicated cdn dist folder/target (that is not used by NPM at all)
  • fold browser exports path onto node exports path.
    • update entrypoint documentation.

Blocked by:

  • replace @microsoft/fetch-event-source
  • amend exponential-backoff so that it either includes its sources, or use inline-source-map
    • check what other "big" packages do.

internalize fetch-event-source w/ patch
@louis-bompart
Copy link
Collaborator Author

louis-bompart commented Feb 14, 2025

Bundle size will be broken for this PR because we changed the directory from dist/browser to cdn

@louis-bompart louis-bompart marked this pull request as draft February 19, 2025 06:03
@louis-bompart
Copy link
Collaborator Author

Too big. Needs to be splitted.

github-merge-queue bot pushed a commit that referenced this pull request Feb 20, 2025
splits from #4921

Replace
[`@microsoft/fetch-event-source`](https://github.com/Azure/fetch-event-source).

Essentially a good old copy of the sources, with our patch applied on
top and some tweaks in the UT so that they work with Vitest.

Includes a copy of the
[LICENSE](https://github.com/Azure/fetch-event-source/blob/a0529492576e094374602f24d5e64b3a271b4576/LICENSE).
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

Successfully merging this pull request may close these issues.

[Bug]: Source Map Errors from Headless Dependencies
1 participant