bpampuch / pdfmake

Client/server side PDF printing in pure JavaScript
http://pdfmake.org
Other
11.44k stars 2.02k forks source link

Error when using with vite production build #2678

Closed smitbhalodiya closed 3 months ago

smitbhalodiya commented 4 months ago

When using in a Laravel with Vite.

I am importing the library like this:

import pdfFonts from 'pdfmake/build/vfs_fonts';
pdfMake.vfs = pdfFonts.pdfMake.vfs;

image

This code works fine when running with vite watch

I am importing the library like this: import * as pdfFonts from 'pdfmake/build/vfs_fonts';

It successfully ran the Yarn Build command without encountering any build errors, but see errors in the console. image

SamirMishra27 commented 4 months ago

Hi, have you found a solution to this? I'm also facing same exact issue in production deployment of site, using react and vite as build tool.

Edit: found potential solutions in #2654

smitbhalodiya commented 3 months ago

Hi @SamirMishra27, Everything worked out!, thank you very much!