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

feat: libraries in workers #2269

Merged

Conversation

haakonflatval-cognite
Copy link
Contributor

@haakonflatval-cognite haakonflatval-cognite commented Jul 7, 2022

Description

Suggestion for setup that allows for libraries in workers.
Unfortunately, it seems like we won't be able to avoid bundling such libraries with Reveal. Currently, it is a bit unclear how exactly the dependency is bundled (whether within the worker itself or outside), and figuring this out is tracked as its own issue. A question has been posted by us on Stackoverflow on tips on how to achieve this, but it has so far seen little attention.

The approach in this PR is to split the Webpack configuration into two paths, one for the index.js entry point, and one for the rest ("peripheral entries"). The index.js bundle has an externals-allow list that ensures it bundles additional dependencies in only that bundle, so we avoid unnecessary duplicates.

This PR should target the point cloud feature branch, but targets another branch (at the time of writing) that is expected to be merged first. We may also discuss whether this should go directly to master, although that will a bit more inconvenient at this point, and seems unnecessary.

Checklist:

Here is a checklist that should completed before merging this given feature.
Any shortcomings from the items below should be explained and detailed within the contents of this PR.

  • I am proud of this feature.
  • I have performed a self-review of my own code.
  • I have manually tested this for different scenarios (different models, formats, devices, browsers).
  • I have commented my code in hard-to-understand areas.
  • I have made corresponding changes to the public documentation.
  • I have added unit and visuals tests to prove that my feature works to the best of my ability.
  • I have refactored the code for readability to the best of my ability.
  • I have checked that my changes do not introduce regressions in the public documentation.
  • I have outlined any known defects / lacking capabilities in the contents of this PR.
  • I have listed any remaining work that should follow this PR in the description or jira/miro/etc.
  • I have added TSDoc to any public facing changes.
  • I have added "developer documentation" in any package README.md that is related / applicable to this PR.
  • I have noted down and am currently tracking any technical debt introduced in this PR.
  • I have thoroughly thought about the architecture of this implementation.
  • I have asked peers to test this feature.

@haakonflatval-cognite haakonflatval-cognite requested a review from a team as a code owner July 7, 2022 14:47
@haakonflatval-cognite haakonflatval-cognite added the slack PRs and issues with this label will be pushed to Slack label Jul 7, 2022
@codecov
Copy link

codecov bot commented Jul 7, 2022

Codecov Report

Merging #2269 (a3cfbb3) into feat/point-cloud-styling (d765a15) will increase coverage by 1.05%.
The diff coverage is 60.06%.

@@                     Coverage Diff                      @@
##           feat/point-cloud-styling    #2269      +/-   ##
============================================================
+ Coverage                     70.37%   71.43%   +1.05%     
============================================================
  Files                           271      271              
  Lines                         11072    11216     +144     
  Branches                       1405     1437      +32     
============================================================
+ Hits                           7792     8012     +220     
+ Misses                         3123     3041      -82     
- Partials                        157      163       +6     
Impacted Files Coverage Δ
viewer/.eslintrc.js 0.00% <ø> (ø)
viewer/index.ts 0.00% <0.00%> (ø)
viewer/internals.ts 0.00% <0.00%> (ø)
viewer/jest.config.js 0.00% <ø> (ø)
viewer/packages/api/src/migration.ts 0.00% <ø> (ø)
viewer/packages/api/src/public/RevealManager.ts 73.45% <ø> (ø)
...kages/api/src/public/migration/RenderController.ts 100.00% <ø> (ø)
viewer/packages/api/src/public/types.ts 100.00% <ø> (ø)
viewer/packages/api/src/utilities/Spinner.ts 84.37% <ø> (ø)
...ewer/packages/api/src/utilities/ViewStateHelper.ts 59.32% <ø> (ø)
... and 119 more

Base automatically changed from hflatval/point-cloud-api-for-styling to feat/point-cloud-styling July 18, 2022 06:57
NB: Splits the webpack config to avoid bundling ThreeJS in more than one output. Further investigation required to figure out how to not bundle ThreeJS at all
@haakonflatval-cognite haakonflatval-cognite force-pushed the hflatval/libraries-in-workers branch from 60a80e3 to a3cfbb3 Compare July 18, 2022 07:14
@larsmoa larsmoa added the preview-docs Deploy preview documentation for a PR label Jul 19, 2022
@github-actions
Copy link

📙 Documentation preview is available from
https://cognitedata.github.io/reveal-docs-preview/2269/docs/next/.

@haakonflatval-cognite haakonflatval-cognite merged commit 5018205 into feat/point-cloud-styling Aug 2, 2022
@haakonflatval-cognite haakonflatval-cognite deleted the hflatval/libraries-in-workers branch August 2, 2022 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview-docs Deploy preview documentation for a PR slack PRs and issues with this label will be pushed to Slack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants