From a4d3015367f6d004d60e0c111999b0671df2309b Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 28 Oct 2025 17:01:05 +0100 Subject: [PATCH] add app_root to dashboard widget path, add buildtimestamp to external imports during rollup build --- public/js/components/Dashboard/Item.js | 2 +- rollup.config.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/js/components/Dashboard/Item.js b/public/js/components/Dashboard/Item.js index d2ad4ae75..7cf32bc91 100644 --- a/public/js/components/Dashboard/Item.js +++ b/public/js/components/Dashboard/Item.js @@ -144,7 +144,7 @@ export default { }, async created() { this.widget = await CachedWidgetLoader.loadWidget(this.id); - let component = (await import("../" + this.widget.setup.file)).default; + let component = (await import(FHC_JS_DATA_STORAGE_OBJECT.app_root + this.widget.setup.file + '?' + FHC_JS_DATA_STORAGE_OBJECT.fhcomplete_build_version)).default; this.$options.components["widget" + this.widget.widget_id] = component; this.component = "widget" + this.widget.widget_id; this.arguments = { ...this.widget.arguments, ...this.config }; diff --git a/rollup.config.js b/rollup.config.js index 3d5dca274..f36eb83df 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -12,6 +12,7 @@ import { existsSync } from 'node:fs'; import terser from '@rollup/plugin-terser'; import json from '@rollup/plugin-json'; +const buildtimestamp = new Date().toISOString().replace(/[-T:]/g, '').substr(0,14); const fhcbasepath = import.meta.dirname; let apps = {}; let curapp = null; @@ -40,7 +41,7 @@ function FhcResolver () { if( source.includes('index.ci.php') ) { //console.log('source: ' + source + ' curapp: ' + curapp + ' importer: ' + importer); let source_abs = fhcbasepath + '/' + source.replace(/(\.\.\/)+/, ''); - let source_rel = path.relative(path.dirname(curapp), source_abs); + let source_rel = path.relative(path.dirname(curapp), source_abs) + '?' + buildtimestamp; //console.log('SOURCE_ABS:' + source_abs + 'APP: ' + curapp + 'SOURCE_REL: ' + source_rel); return { id: source_rel, external: 'relative'}; } @@ -52,7 +53,7 @@ function FhcResolver () { if(source_abs.match(/\/FHC-Core-[^\/]+\/public\//)) { source_abs = fhcbasepath + source_abs.replace(/^.+?\/(FHC-Core-[^\/]+)\/public\//, '/public/extensions/$1/'); } - let source_rel = path.relative(path.dirname(curapp), source_abs); + let source_rel = path.relative(path.dirname(curapp), source_abs) + '?' + buildtimestamp; //console.log('SOURCE_ABS:' + source_abs + 'APP: ' + curapp + 'SOURCE_REL: ' + source_rel); return { id: source_rel, external: 'relative'}; } @@ -168,7 +169,7 @@ export default globSync('public/**/js/apps/**/*.js', {follow: false, realpath: f sourceMap: true }) ]; - const vuedatepicker = path.relative(path.dirname(outputfile), basepath + 'components/vueDatepicker.js.php'); + const vuedatepicker = path.relative(path.dirname(outputfile), basepath + 'components/vueDatepicker.js.php?' + buildtimestamp); //console.log(vuedatepicker); return { input: tmp,