I want to use to pdfmaker in my Stenciljs project and following the official Guideline as well as previous question at stackoverflow:
error TS2540: Cannot assign to 'vfs' because it is a read-only property
I have first installed pdfmake via npm
npm install pdfmake
Then I am trying to use it in a component which is called my-messages:
import * as pdfMake from "pdfmake/build/pdfmake";
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
(pdfMake as any).vfs = pdfFonts.pdfMake.vfs;
My component wont even initialize and I keep getting the following the errors in Browser:
TypeError: Cannot read properties of undefined (reading 'pdfMake')
at my-messages.entry.js:78239 undefined
index-2022e853.js:1949 Uncaught (in promise) Error: Constructor for "my-messages#undefined"
was not found at initializeComponent