I am new with Svelte
and trying to import
some package.
After the npm install
, I import it directly into my svelte
file:
import jspdf from "jspdf"
that got me the error:
Error: UMD and IIFE output formats are not supported for code-splitting builds.
then I tried to use CDN and import via HTML
:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.1.1/jspdf.umd.min.js"></script>
and the svelte
give me undefined
error from:
var doc = new jsPDF();
I googled and some some comments and it seems like the first solution should already be working. How can I resolve this?