TaTo30 / vue-pdf

PDF component for Vue 3
https://tato30.github.io/vue-pdf/
MIT License
472 stars 65 forks source link

[vite] warning #123

Closed NetMango closed 4 months ago

NetMango commented 4 months ago

Hi.

After upgrading from 1.7.4 to 1.10.0 I got this warning:

13:51:24 [vite] warning: 
/node_modules/.q-cache/vite/spa/deps/@tato30_vue-pdf.js
3845|                  /*webpackIgnore: true*/
3846|                  this.workerSrc
   |                  ^
3847|                );
3848|                return worker.WorkerMessageHandler;
The above dynamic import cannot be analyzed by vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.

Just put

/* @vite-ignore */

into code and warning disappears. Like this:

              if (this.#mainThreadWorkerMessageHandler) {
                return this.#mainThreadWorkerMessageHandler;
              }
              const worker = await import(
                /*webpackIgnore: true*/
                /* @vite-ignore */
                this.workerSrc
              );
              return worker.WorkerMessageHandler;
            };`

Thank you :)

TaTo30 commented 4 months ago

Thanks for the suggestion, this is an issue directly from pdfjs so nothing can be done at the level of the vue-pdf component.