randolphtellis / vue3-pdfjs

PDF Reader for Vue 3 using Mozilla's PDF.js
MIT License
92 stars 17 forks source link

Error when running with vite #11

Open Yanren1225 opened 2 years ago

Yanren1225 commented 2 years ago
$ yarn dev
yarn run v1.22.17
warning ../package.json: No license field
$ vite --host
error when starting dev server:
Error: The following dependencies are imported but could not be resolved:

  vue3-pdfjs/components/vue-pdf/vue-pdf-props (imported by /Users/nihaocun/Code/caseable-nft-web/src/page/introduction/index.vue)
  pdfjs-dist/types/src/display/api (imported by /Users/nihaocun/Code/caseable-nft-web/src/page/introduction/index.vue)

Are they installed?
    at optimizeDeps (/Users/nihaocun/Code/caseable-nft-web/node_modules/vite/dist/node/chunks/dep-9c153816.js:55767:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOptimize (/Users/nihaocun/Code/caseable-nft-web/node_modules/vite/dist/node/chunks/dep-9c153816.js:56647:44)
    at async Server.httpServer.listen (/Users/nihaocun/Code/caseable-nft-web/node_modules/vite/dist/node/chunks/dep-9c153816.js:56662:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

But I'm afraid I did install it, is there any configuration that needs to be done?

Incidentally, there is no problem using vite build

pittQ commented 2 years ago

我也遇到了同样的问题,请问是怎么解决的?

pittQ commented 2 years ago

The following dependencies are imported but could not be resolved:

vue3-pdfjs/components/vue-pdf/vue-pdf-props (imported by F:/WitBus/sz-bus-info-distribute-cms/src/views/components/PDFPreviewDialog.vue?id=0) pdfjs-dist/types/src/display/api (imported by F:/WitBus/sz-bus-info-distribute-cms/src/views/components/PDFPreviewDialog.vue?id=0)

Are they installed?

Yanren1225 commented 2 years ago

我也遇到了同样的问题,请问是怎么解决的?

没解决,反正 PDF 里面只有一些文字和图片,我直接手写了。这个库还要占用 300 KB,PDF 还要几 MB,算下来还是手写吧,省空间哈哈。