cidgoh / DataHarmonizer

A standardized browser-based spreadsheet editor and validator that can be run offline and locally, and which includes templates for SARS-CoV-2 and Monkeypox sampling data. This project, created by the Centre for Infectious Disease Genomics and One Health (CIDGOH), at Simon Fraser University, is now an open-source collaboration with contributions from the National Microbiome Data Collaborative (NMDC), the LinkML development team, and others.
MIT License
91 stars 23 forks source link

Use dynamic import for Getting Started content #379

Closed pkalita-lbl closed 1 year ago

pkalita-lbl commented 1 year ago

The Getting Started carousel content was already included in a separate module (lib/toolbarGettingStarted.js) because I was hoping that would make it tree-shakable -- i.e. that content could be omitted from downstream client bundles if they weren't import-ing the Toolbar component. Unfortunately, it turns out that's not the case because the Toolbar module itself cannot be marked as side-effect free.

Here is an alternative approach where the lib/toolbarGettingStarted module is dynamically imported the first time the Getting Started carousel is opened. This results in a separate, dynamically-loaded output chunk in the ES build of the library. The UMD build doesn't support such constructs, so it still needs to be inlined there. But I would expect most downstream clients to be using the ES build anyway (NMDC, in particular, does).