samply / lens

A reusable toolkit for rich federated data exploration.
3 stars 1 forks source link

Fix issues with Linking Library #141

Closed torbrenner closed 1 week ago

torbrenner commented 2 weeks ago

General Summary

Ensure dist directory structure without relying on a custom plugin.

Description

In the case of running npm run watch, on the first build vite will run all plugins, but with later rebuilds the plugins are not again run. This causes issues in the scenarion in which you try to build the library locally and link it to a depending application. In those cases changes to the library wont be picked up by the depending application. As a side note, i needed to disable the removal of the dir on each by vite (emptyOutDir option), as otherwise after the first rebuild in npm run watch the types file would be deleted and the dts plugin would also not trigger. To simulate the clearing beheaviour at least for normal builds, i added a rimraf dist to npm run build.


How Has This Been Tested?

By localy linking to the BBMRI Sample Locator Application. Please note it was also necessary to add

optimezeDeps: {
  exclude: ["@sample/lens"]
}

to the vite config of the depending project, as otherwise vite wont pick up changes.