How to properly import @mendix/widget-plugin-platform/preview/structure-preview-api module node module during widget development?

0
Hello! I'm attempting to build a new pluggable widget following some of the philosophies utilized within the web widgets Github repository (especially for building my Classic Structure Mode preview for the Windows devs utilizing it). I've been successfully able to build a working and stylized Classic Structure Mode preview, but have been having a hard time implementing the default theming available through the light and dark palettes in the @mendix/widget-plugin-platform/preview/structure-preview-api js module. For some reason, the build process gets really caught up when trying to import this module. However, I can see the file in what appears to be the right place within node_modules, and I'm at least pretty sure it is not a configuration issue as I hit the same issue when trying to build a widget in the previously linked web widgets repository following the steps in the Development section of the root README.md. Does anyone have any idea what I can do to fix this? Or has something changed to prevent this javascript module from being used like I see it used in several major widgets (ex: DataGrid2)? Any advice is appreciated.
asked
1 answers
0

Hi Valerie Harris

 

It’s not just you the Structure Preview API imports recently changed and older examples (like DataGrid2) no longer match the current build setup. The @mendix/widget-plugin-platform/preview/structure-preview-api module is no longer exposed as a direct import during the pluggable widget build pipeline, which causes the build to hang or fail when referenced. Short Fix Recommendation is Instead of importing theme palettes directly, rely on Mendix-generated preview CSS variables (light/dark) these are now the supported theming path for Classic Structure Mode previews.

answered