Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise.withResolvers is not a function #3

Open
edanweis opened this issue Sep 10, 2024 · 1 comment
Open

Promise.withResolvers is not a function #3

edanweis opened this issue Sep 10, 2024 · 1 comment

Comments

@edanweis
Copy link

I have tried using with Nuxt3 SSR creating a new register-components.ts with "nuxt": "^3.12.3"

import { addComponent, defineNuxtModule } from "@nuxt/kit";
export default defineNuxtModule({
  setup() {
    addComponent({
      name: "MyPDFViewer",
      export: "VPdfViewer",
      filePath: "@vue-pdf-viewer/viewer",
    });
  },
});

Installed with pnpm. Used override "pdfjs-dist": "4.4.168". Added

transpile: [
      (ctx) => ctx.isServer ? 'pdfjs-dist': false,
      (ctx) => ctx.isServer ? '@vue-pdf-viewer/viewer': false
    ]

But get error

ERROR  Promise.withResolvers is not a function

  at node_modules/.pnpm/pdfjs-dist@4.6.82/node_modules/pdfjs-dist/build/pdf.mjs:5744:35
  at ViteNodeRunner.runModule (node_modules/.pnpm/vite-node@1.6.0_@types+node@20.14.11_sass@1.77.7_terser@5.31.3/node_modules/vite-node/dist/client.mjs:362:11)
  at ViteNodeRunner.directRequest (node_modules/.pnpm/vite-node@1.6.0_@types+node@20.14.11_sass@1.77.7_terser@5.31.3/node_modules/vite-node/dist/client.mjs:346:16)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async ViteNodeRunner.cachedRequest (node_modules/.pnpm/vite-node@1.6.0_@types+node@20.14.11_sass@1.77.7_terser@5.31.3/node_modules/vite-node/dist/client.mjs:189:14)
  at async ViteNodeRunner.dependencyRequest (node_modules/.pnpm/vite-node@1.6.0_@types+node@20.14.11_sass@1.77.7_terser@5.31.3/node_modules/vite-node/dist/client.mjs:233:12)
  at async node_modules/.pnpm/@vue-pdf-viewer+viewer@1.2.0_pdfjs-dist@4.6.82_vite@5.3.3_@types+node@20.14.11_sass@1.77.7_te_bkttvcxbydyexkslis3mv7nnq4/node_modules/@vue-pdf-viewer/viewer/dist/index.js:2:31
  at async ViteNodeRunner.runModule (node_modules/.pnpm/vite-node@1.6.0_@types+node@20.14.11_sass@1.77.7_terser@5.31.3/node_modules/vite-node/dist/client.mjs:362:5)
  at async ViteNodeRunner.directRequest (node_modules/.pnpm/vite-node@1.6.0_@types+node@20.14.11_sass@1.77.7_terser@5.31.3/node_modules/vite-node/dist/client.mjs:346:5)
  at async ViteNodeRunner.cachedRequest (node_modules/.pnpm/vite-node@1.6.0_@types+node@20.14.11_sass@1.77.7_terser@5.31.3/node_modules/vite-node/dist/client.mjs:189:14)
<ClientOnly>
	<MyPDFViewer :src="props.panel?.data?.output.url" />
</ClientOnly>
@kittisakLS
Copy link
Contributor

kittisakLS commented Sep 12, 2024

addComponent

Referring to Components · Nuxt Kit, the VPV doesn't run on the server-side. So, I think you may need to add mode: 'client' when using addComponent to register the component.

addComponent({
   name: "MyPDFViewer",
   export: "VPdfViewer",
   filePath: "@vue-pdf-viewer/viewer",
   mode: 'client'
});

Hope this helps! Let me know if it doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants