Hello! We're on v0.10.0 of the library and we're using Create React App (react-scripts@5.0.0). We're running into an issue when we try to import html2pdf.js:
import html2pdf from 'html2pdf.js';
Our dev server returns the following:
Failed to parse source map from '.../node_modules/html2pdf.js/dist/es6-promise.map' file: Error: ENOENT: no such file or directory, open '.../scheduler_web/node_modules/html2pdf.js/dist/es6-promise.map'
WARNING in ./node_modules/html2pdf.js/dist/html2pdf.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '.../node_modules/html2pdf.js/dist/es6-promise.map' file: Error: ENOENT: no such file or directory, open '.../node_modules/html2pdf.js/dist/es6-promise.map'
@ ./src/manage_data/app/utils/pdf.utils.js 3:0-35 52:9-17
@ ./src/manage_data/app/pages/data_summary_schedule_data_page.js 33:0-60 190:11-33
It looks like the problem is related to line 5729 in html2pdf.js:
//# sourceMappingURL=es6-promise.map
... since this source map is not included in html2pdf.js/dist folder.
I was able to verify that including es6-promise.map in html2pdf.js/dist did clear the warning.
Workaround
It looks like the minified version of the library is not importing es6-promise.map so I've changed the import for this file instead:
import html2pdf from 'html2pdf.js/dist/html2pdf.min.js';
Let me know if you need any other information. Thank you for this useful library 🙏
Hello! We're on v0.10.0 of the library and we're using Create React App (
react-scripts@5.0.0
). We're running into an issue when we try to importhtml2pdf.js
:Our dev server returns the following:
It looks like the problem is related to line 5729 in
html2pdf.js
:... since this source map is not included in
html2pdf.js/dist
folder. I was able to verify that includinges6-promise.map
inhtml2pdf.js/dist
did clear the warning.Workaround
It looks like the minified version of the library is not importing
es6-promise.map
so I've changed the import for this file instead:Let me know if you need any other information. Thank you for this useful library 🙏