-
Notifications
You must be signed in to change notification settings - Fork 489
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
Routing issues in typescript project #552
Comments
I seem to have the same problem using Gridsome v 0.6.6, however I am not using Typescript. |
@Js-Brecht is this something you also experience? See video: https://www.loom.com/share/bc27ccb43c9d43ff9cc6e254fdb75b93 |
Works when changing index.vue script to:
Seems to be a problem with the |
@Js-Brecht Vue doesn't support classes natively, so I think you need to use the import Vue from 'vue'
import Component from 'vue-class-component'
@Component
export default class MyComponent extends Vue {
// ...
} |
@hjvedvik This doesn't solve the issue though. Still get
|
Sorry, I do use the decorator. Forgot to put it back after testing it as an object. I do still get the same error, though. Also, if I start at |
I've faced the same issue using TypeScript and |
I'd like to know as well. This is a show stopper for me. It's important for what I'm trying to use Gridsome for, that I be able to use classes. |
Same problem here, haven't found any workaround yet :( |
Same for me, using out of box gridsome with Typescript running on Netlify and getting |
Can also reproduce this issue on a blank project with just the typescript plugin and dependencies installed. cc @hjvedvik |
@hjvedvik @tomtev Guys, really need your assistance here! Do you have any idea about this issue? How can we debug it? Do you know how can I make a not-minified build? It's very difficult to debug the built app now. Please, find a minute to take a look at this issue... Thank you! [UPDATE] |
@yurist38 i had same issue. I am using gridsome-typescript. turns out, Gridsome may changed the way of tsconfig.json check out the lastest from here https://gridsome.org/plugins/gridsome-plugin-typescript
if not helping, try to do npm ci and remove package-lock.json, basically flush out all existing version in the package.json hope helps. |
@kororo Thanks for the input! So how exactly did you fix this issue in your case? Changed your |
@yurist38, yep i did change the tsconfig.json and it works for me.
maybe worth to mention, update to the latest gridsome version. |
@kororo No luck here so far... Adding exactly this tsconfig.json file to the test project doesn't change anything. 😞 feeling really hopeless against this problem 😄 |
I finally found some time to debug this and found the cause in Gridsome. Will do some more tests and hopefully, publish a fix tomorrow :) Thanks for the reproduction repo @yurist38 |
@hjvedvik, let us know what is the bug? Thinking to link for other github bug that related. It seems quite fundamental bug between vue, ts and webpack combo |
Such a sweet update, @hjvedvik! Thanks a lot from all of us! :) |
@kororo It might be that some libraries (including Gridsome) check if a component is a function in order to resolve dynamic imports. Normally a resolved component is an object, but it can also be a function. So the fix was to not execute the function if it has a |
@hjvedvik right thanks! it seems quite specific gridsome implementation. thanks for the fix!! |
I can confirm that after updating |
Hi, I still have this issue. I am using typescript and vue-property-decorator. The dev server is working just fine but when i build the project I can't navigate the website. The content gets loaded but is not display and sometimes 'Cannot read property '_init' of undefined' pops up in the console. Switching back to gridsome 0.7.9 from 0.7.11 did not change things either. |
Anyone was able to ever find a work around for this? |
Hi, in my case it was my fault - i wrote some bad html which usually does not bother the browser but for client-side-hydration you need to have correct html. In my case i had an anchor inside another anchor which is invalid html and caused my page to load initially but I could not load another sub-site because the client-side-hydration failed. Make sure you write valid html. It will most likely fix your errrors. https://ssr.vuejs.org/guide/hydration.html |
Description
Navigation between pages fails when hosting Gridsome site after
gridsome build
, usinggridsome serve
, or even using a generic HTTP server.Steps to reproduce
Create Gridsome project with typescript starter pack.
Install packages, and serve content
About
page.Home
pageExpected result
It should navigate back to the
Home
page.Actual result
Nothing happens. An error is thrown in the browser console
If you set
Webpack.mode('development')
in thechainWebpack
api, the exception thrown in the browser console will indicate that the error was thrown by Vue, when instantiating the component.This error doesn't occur when running
gridsome develop
.It looks like the issue occurs when using Vue classes.
This breaks:
This doesn't
This could simply be an issue between Typescript and Vue. It's been a while since I've used Typescript+Vue; things have probably changed in the interim. I'll need to create a repo using just Typescript+Vue, without Gridsome, to see if this has anything to do with Gridsome. Could just be a bug in Vue-Router
Environment
The text was updated successfully, but these errors were encountered: