Error loading Docx library

Im trying to create a button that will download a custom word document.
i imported the CDN for docx under js libraries
https://cdn.jsdelivr.net/npm/docx@8.2.2/build/index.min.js
and now i'm trying to use the library in a script within the button:
window.docx gives me an error and anything else i've tried seems to be undefined.
any ideas what went wrong?
Am i better off trying to create a google docs?

you should place docx library in custom component, here is demo for your reference