When building a widget for Dashboard-2, vite places the resulting file into the /resources folder:
Unfortunately, as it's documentation states,
by default, Vite will empty the outDir on build if it is inside project root.
This is unfortunate, as it deletes as well all (other) files existing in /resources, thus breaking the mechanism to provide additional files to load into the editor as extra resources.
I've created a PR to fix this issue:
- Rather than building directly into
/resources,viteshall build intoui/distdirectory. - The resulting file will then be copied into
/resources. - The operation will be performed by
vite-plugin-static-copy, added asdev-dependency. - To compensate for an error when trying to require an ESM only module,
vite.config.jshas to be renamed tovite.config.mjs. - Took the opportunity to fix as well the repo path in
package.json, still pointing to aflowforgerepo, non-existing.