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.
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 innpm 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 arimraf dist
tonpm run build
.How Has This Been Tested?
By localy linking to the BBMRI Sample Locator Application. Please note it was also necessary to add
to the vite config of the depending project, as otherwise vite wont pick up changes.