You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm requesting this module to add support for native ESM modules so it can be loaded in environments where common js is not supported. For example jest native ESM mode.
add "type": "module" to package.json and "exports" entry point
The text was updated successfully, but these errors were encountered:
Solution for using html-to-pdfmake in module-based environments (e.g., Angular 18, Jest ESM)
I encountered the same issue while using html-to-pdfmake in Angular 18 due to its CommonJS implementation not being compatible with native ES Modules. Instead of the standard:
import * as htmlToPdfMake from 'html-to-pdfmake';
I used the following alternative syntax:
import _ from 'html-to-pdfmake';
This syntax resolved the issue and allowed the library to function seamlessly in an ESM environment.
Why it Works
• This syntax ensures compatibility with CommonJS modules in environments expecting ES Module exports.
• The underscore _ correctly handles the default export from the CommonJS module.
I'm requesting this module to add support for native ESM modules so it can be loaded in environments where common js is not supported. For example jest native ESM mode.
add
"type": "module"
to package.json and "exports" entry pointThe text was updated successfully, but these errors were encountered: