tuandm/laravue

app.css empty after import jsPDF

leonpug opened this issue · 4 comments

Hi,
try to use jsPDF with laravue with:

import jsPDF from 'jspdf'; ... const pdfName = 'test'; const doc = new jsPDF(); doc.text('Hello World', 10, 10); doc.save(pdfName + '.pdf'); ...

after npm run dev my app.css is 0 byte! No error in compiling or in console.
If I remove jsPDF import and code, everything run normally.

Any ideas?
Thanks

Hi,
try to use jsPDF with laravue with:

import jsPDF from 'jspdf'; ... const pdfName = 'test'; const doc = new jsPDF(); doc.text('Hello World', 10, 10); doc.save(pdfName + '.pdf'); ...

after npm run dev my app.css is 0 byte! No error in compiling or in console.
If I remove jsPDF import and code, everything run normally.

Any ideas?
Thanks

New version import with { jsPSF }

Try

import { jsPDF } from 'jspdf';

const doc = new jsPDF();
doc.save("a4.pdf");

Thanks for replay
It does not work.

screenshot_000

I don't know what are these files:

0.js
1.js
...

This is happening to me too.

"app.css" completely empty after "npm run dev"

Hi!, let this here to help someone with the same problem:

Update laravel-mix to v6 should fix this issue

Looks like it was a problem with webpack v4 and dynamics imports, which is fixed in v5+

Source: laravel-mix/laravel-mix#1870