Uncaught ReferenceError: docx is not defined
dominodelarge opened this issue · 1 comments
dominodelarge commented
docx.renderAsync() has stopped working, throwing a "docx is not defined" error.
No changes to code or scripts.
The document itself is generated successfully and can be downloaded in the browser, but it can no longer be previewed.
if (action === 'preview') {
// Render the Word Document in the container. **(THIS FAILS)**
docx.renderAsync(blob, document.querySelector("#modal-container"), null, docxOptions);
$('#previewLetterModal').modal();
} else if (action === 'download') {
// Trigger the download of the generated document. **(THIS WORKS)**
saveAs(blob, "hf-letter.docx");
}
I am using the following libraries (which have remained unchanged for months):
<script src="https://unpkg.com/jszip/dist/jszip.min.js"></script>
<script src="https://volodymyrbaydalka.github.io/docxjs/dist/docx-preview.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/docxtemplater/3.40.1/docxtemplater.js"></script>
<script src="https://unpkg.com/pizzip@3.1.4/dist/pizzip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.js"></script>
<script src="https://unpkg.com/pizzip@3.1.4/dist/pizzip-utils.js"></script>
VolodymyrBaydalka commented
github
is NOTcdn
docx-preview
migrating to js modules. UMD module could be found underdocx-preview.umd.js