Open Draught707 opened 3 years ago
Oh. It works. But I have the same problem like in recent issue Some contents are missing!!
Same error, and it is only since 0.10
Hi, this console message won't prevent the package from working. It's just a warning about source-maps, which allow your code inspector to read minified code as if it wasn't minified.
I haven't been able to reproduce - the files load with no warnings on my end. It's possible though that the package dependency SVGPathData hasn't correctly provided a source-map, if so there's not much I can do about it. You may be able to suppress the warning if you're concerned about it.
@eKoopmans you just need to use what is documented in the readme of the project, on any website:
function addScript(url) {
var script = document.createElement('script');
script.type = 'application/javascript';
script.src = url;
document.head.appendChild(script);
}
addScript('https://raw.githack.com/eKoopmans/html2pdf/master/dist/html2pdf.bundle.js');
this will immediately throw Failed to load resource: the server responded with a status of 404 ()
on https://raw.githubusercontent.com/eKoopmans/html2pdf/master/dist/SVGPathData.module.js.map
Why?
Because the file does not exist on this repo but it is included in the main script, see //# sourceMappingURL=SVGPathData.module.js.map
in https://raw.githack.com/eKoopmans/html2pdf/master/dist/html2pdf.bundle.js
While this will not break anything and usually only appears if you have debug mode on/sometimes browser do not even flag this it should still be solved. It's in the main JS file, and the comment can either be removed, or map provided on your repo, since that is where it points to, and then it will be solved and avoid JS errors thrown when this library is used.
This issue is been introduced with the new updates, it did not happen in prior versions.
You may be able to suppress the warning if you're concerned about it.
This is not a solution. It works only on my browsers, not on the clients or visitors, since they would also have to do the same. In terms of delivering clean error free sites this should be resolved. All major codes where I reported this (there are many that have this error, it is very common), did resolve it, just for the sake of clean consoles.
Acknowledged. I was looking at the minified version which does not produce this warning, but you're right that the un-minified does.
I'll have a look when I have a chance - looks like source-map-loader may be required here.
The reason this wasn't an issue pre-0.10 is because I had to change bundlers from Rollup to Webpack, it's caused a lot of headaches.
How can I download previous version??? It works!!!
You create a file on your website/server and call that file instead of the remote one. You can use this https://gist.github.com/TukuToi/b24a34ba6354fe6cac557174dc07238d
But if you already confirmed "it works" on said version, it means you already downloaded it, thus.. you can use it ;)
I recommend using cdnjs and pointing to the specific version you want - go here: https://cdnjs.com/libraries/html2pdf.js
E.g. using this script:
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.3/html2pdf.bundle.min.js" integrity="sha512-YcsIPGdhPK4P/uRW6/sruonlYj+Q7UHWeKfTAkBW+g83NKM+jMJFJ4iAPfSnVp7BKD4dKMHmVSvICUbE/V1sSw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
DevTools failed to load source map: Could not load content for https://raw.githack.com/eKoopmans/html2pdf/master/dist/SVGPathData.module.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE however it works about week ago.