Vitesse + vue3-pdfjs - issue with "SyntaxError: Cannot use import statement outside a module" #262
Replies: 5 comments
-
@spokospace - Throw your code up on stackblitz https://stackblitz.com/github/antfu/vitesse otherwise it's hard to diagnose. Vitesse is just a really nicely structured vanilla vite / vue. At a guess I'd say that this is a problem with your Vue implementation. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this page, very useful. Okay, so looks like here it's working like a charm: https://stackblitz.com/edit/github-ijnjm5?file=src%2Fpages%2F[lang]%2Fdocs%2F[doc].vue I tested it in the same structure like in my project ( /en/docs/1 ) so I don't know where is the issue when I run it on localhost... |
Beta Was this translation helpful? Give feedback.
-
Ok, I had upgraded all dependencies and put pnpm install again. Now everything is working, so I believe there was something wrong with old dependencies. Problem solved! Thx! |
Beta Was this translation helpful? Give feedback.
-
Ok, so after the update it looks okay on develop, but when I tried to build I have this error:
is it any way to fix this issue with a change in config or something like that? here is example: https://stackblitz.com/edit/github-ijnjm5 (just run pnpm build) |
Beta Was this translation helpful? Give feedback.
-
I tried to import this using cjs instead of esm:
but then I have this error:
Do I need to create a separate module to fix this issue (like src/modules/pwa.ts)? example: https://stackblitz.com/edit/github-ijnjm5?file=src%2Fpages%2F[lang]%2Fdocs%2F[doc].vue |
Beta Was this translation helpful? Give feedback.
-
Hello, I tried to solve this problem, however I can't deal with it.
I can't resolve the issue with the correct way to use Pdfvuer. I tried load PDF preview with Pdfvuer for Vue3 (https://github.com/arkokoley/pdfvuer/tree/vue3), and vue3-pdfjs (https://github.com/randolphtellis/vue3-pdfjs) but still have a fault, e.g.:
I tried to put this as a function, and run after click on the button, load it with 'onMounted' etc.
Is it possible to load PDF in any way with vitesse js?
I tried with:
and like this:
template (like Basic Example in vue3-pdfjs | https://github.com/randolphtellis/vue3-pdfjs ):
Beta Was this translation helpful? Give feedback.
All reactions