How to add dependency module in custom mendix widget in build and deployment

0
Hi Everyone ,   I am working on the custom widget where i added a react-doc-viewer module to show the file in the application but for working with pdf it needs pdf.worker.min.mjs js file . i can see that this is file is present in this path "node_modules/pdfjs-dist/build/pdf.worker.min.mjs" but when i am building the widget it is not available in "dist/tmp/widgets/ and ${mx.appUrl}widgets/pdfjs-dist/build/pdf.worker.min.js here as well .   Can anyone please help me to know how can we add dependent files to mendix widget
asked
1 answers
0

I have not done this myself with this package, but would it be possible to include the worker file as a static resource and reference it in your widget code? Place it in the src or resource folder of your widget project or any subfolder.

 

You can reference the file in muliple ways from your widget code. Also you could automate at build time to 'update' the node_modules/pdfjs-dist/build version into the widget package to make sure you always have the most updated version without manual copying.

 

Hope this helps you a step further

answered