From d0b02d1df38d74f51f55af254d3677584c5190af Mon Sep 17 00:00:00 2001 From: Roman Vyakhirev Date: Fri, 31 Jul 2026 10:48:04 +0200 Subject: [PATCH] fix: use correct public path for assets in React (ESM) builds Images imported in widgets were not displayed when deployed in the cloud because the ESM bundle used the wrong base path for assets. The ESM output now resolves assets under dist/ (React client path) while AMD output continues to use widgets/ (Dojo path). --- packages/pluggable-widgets-tools/CHANGELOG.md | 4 ++++ packages/pluggable-widgets-tools/configs/rollup.config.mjs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/pluggable-widgets-tools/CHANGELOG.md b/packages/pluggable-widgets-tools/CHANGELOG.md index 9d25aa9b..d71dd55a 100644 --- a/packages/pluggable-widgets-tools/CHANGELOG.md +++ b/packages/pluggable-widgets-tools/CHANGELOG.md @@ -14,6 +14,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - We increased the minimum node version to 22. +### Fixed + +- We fixed an issue where images imported in widgets were not displayed correctly in the React client when deployed in the cloud. + ## [11.12.0] - 2026-06-30 ### Changed diff --git a/packages/pluggable-widgets-tools/configs/rollup.config.mjs b/packages/pluggable-widgets-tools/configs/rollup.config.mjs index 346d6ee9..d267472c 100644 --- a/packages/pluggable-widgets-tools/configs/rollup.config.mjs +++ b/packages/pluggable-widgets-tools/configs/rollup.config.mjs @@ -105,7 +105,11 @@ export default async args => { url({ include: imagesAndFonts, limit: 0, - publicPath: `${join("widgets", outAssetsDir)}/`, // Prefix for the actual import, relative to Mendix web server root + // Prefix for the actual import, relative to Mendix web server root + // dojo uses: "widgets//assets/123abc.png" + // react uses: "dist//assets/123abc.png" + publicPath: + outputFormat === "es" ? `${join("dist", outAssetsDir)}/` : `${join("widgets", outAssetsDir)}/`, destDir: absoluteOutAssetsDir }), postCssPlugin(outputFormat, production),