-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Component is not processed by Webpack ( Unexpected token < ) #13
Comments
It seems that vue-pdf is not processed by vue-loader |
So, I discovered that if I navigate from any Vue to page to the PDF one, the error is not displayed. But, if I request the page from the server (ie. copy the URL and open a new tab for it, or just refreshing the page), the error is displayed. Does it support SSR? |
This is typically a ssr problem. |
Thank you @FranckFreiburger! |
btw, which ssr framework do you use ? |
I'm using Nuxt 1.0.0-alpha.4. |
Thread bump. This still doesn't work with vue-SSR. |
please check with v2.x |
I've tried with v2 but still getting the same issue. Versions: EDIT: |
seems to be fixed, feel free to reopen if needed. |
i am getting almost the exact same error and cannot figure out how to resolve (I am new to Vue so im sure it something simple i have missed). I have tried a few things (listed below) based on the Vue documentation but still stuck. Please advise on how to proceed, thanks!. Versions:
Attempt 1in
in
Attempt 2in
in
|
@FranckFreiburger - this issue is still there. We are using this project's implementation for ssr. I Guess, vue-pdf is not processed by vue-loader. |
@FranckFreiburger - I have pushed a reproducible example here. This might help. Let me know if I can help you with anything else. |
Please give me your error message |
|
weird |
Yes, also as mentioned in this comment - it works properly when we just navigate in client side. |
Is there any update on this ? Also, how do I make it work navigating on client side ? /node_modules/vue-pdf/src/vuePdfNoSss.vue:1 |
same here Error:
my module rules on webpack:
|
I had this issue today, using the nuxt/pwa template nuxt version: 1.4.1 For me, this worked: // plugins/vue-pdf.js
import Vue from 'vue'
import pdf from 'vue-pdf'
Vue.component('pdf', pdf) // nuxt.config.js
plugins: [
{ src: '~/plugins/vue-pdf.js', ssr: false },
], |
The same here, even with the no-ssr component: <no-ssr>
<pdf :src="src"/>
</no-ssr> |
Same issue here
|
@JonasMunck I did what you suggested. It doesn't display the error on the screen anymore, but it shows a white block on my page and 2 errors on console: -> [Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside , or missing . Bailing hydration and performing full client-side render. -> Uncaught ReferenceError: window is not defined |
any solution to the problem? Facing the same issue |
for the |
got exactly the same problem :( SyntaxError: Unexpected token < |
have a look at this thread: nuxt/nuxt#1692 (comment) |
webpack:
nuxt: |
Tried all recent advice .
Any more ideas? |
Not sure if this helps but using Nuxt I came with the following solution. In a Nuxt page component: <no-ssr>
<PDFFilePreview :fileURL="fileURL"></PDFFilePreview>
</no-ssr> import PlaceholderComponent from '~/components/viewers/PlaceholderComponent'
export default {
components: {
PlaceholderComponent,
PDFFilePreview: () => {
if (!process.client) {
return {
component: PlaceholderComponent
}
} else {
return {
component: import('~/components/viewers/PDFFilePreview')
}
}
},
},
} In nuxt.config.js: module.exports = {
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {
config.output.globalObject = '(self || this)'
}
}
} |
遇到同样的问题 |
You can overcome this error by explicitly copying the component and its dependencies into the app. This way it will compile the component just like it compiles all of your other components. |
I tried vendoring the whole package, rendering client-side only, but still hit this same error. |
|
still can't manage to make it works with nuxt... |
If you use Nuxt this may help: I created a plugin pdf.js
added it to nuxt.config.js
and in the template:
|
Solve this issue for nuxt.js |
This is still happening. And all of the duplicate issues seem to be closed. Is there any help out there to resolve this? Using webpack (Laravel-mix) and version "vue-pdf": "^4.3.0", |
This problem still occurs when testing with Jest in my nuxt2 environment as well |
When loaded as the following:
I get the following error:
Am I missing something?
The text was updated successfully, but these errors were encountered: