Closed lourot closed 8 months ago
@brillout no need to review, just a quick interface talk:
As a neat side-effect of this PR I also now happen to support this:
import { usePageContext } from 'vike-vue/usePageContext'
import { useData } from 'vike-vue/useData'
+import { usePageContext } from 'vike-vue/hooks'
+import { useData } from 'vike-vue/hooks'
I think it's slightly nicer DX. I could align vike-react
(with soft deprecation) if you like and I could adapt the docs on https://vike.dev . (@magne4000 FYI I'd also align vike-solid
, and happy also to adapt the Bati boilerplates)
Thank you a lot for doing that.
I should have aligned with you before doing that breaking change. (I was thinking it's fine if only vike-react
exports the config at /config
but I think you're right: it's better if we all align on that as well.) From now on, I will always make a PR and search for consensus prior to introduce any interface change.
+import { usePageContext } from 'vike-vue/hooks' +import { useData } from 'vike-vue/hooks'
That's actually something I've been wondering for quite some time now whether we should do that.
The only reason why I've been relunctant about that is because I presume it can non-negligibly impact dev performance. Let me elaborate.
Let's imagine we go one step further and export everything (that is isomorphic) at the root:
import { usePageContext, ClientOnly } from 'vike-vue'
That's a really neat DX. But it may negatively impact dev performance: if the user doesn't use ClientOnly
, then ClientOnly
is still going to be loaded & transpild even though the user only does import { usePageContext } from 'vike-vue'
. I'm not sure about it, but I presume this how Vite behaves at development time.
But it may negatively impact dev performance: if the user doesn't use
ClientOnly
Indeed I remember now a similar conversation. Thanks a lot for clarifying again :pray:
(I had to force-push in order to update a "breaking change" in the commit message that will be picked up when auto-generating the changelog)
@4350pChris I'm also slightly touching vike-pinia
in this PR. Let me know if not OK.
Looks good, thanks for the docs.
Released as 0.6.1
Partly aligns with vike-react.
BREAKING CHANGE: Update Vike to
0.4.160
or above.BREAKING CHANGE: Replace
import vikeVue from 'vike-vue'
withimport vikeVue from 'vike-vue/config'
. (Typically in your/pages/+config.h.js
.)BREAKING CHANGE: Replace
import type { OnCreateAppSync } from 'vike-vue'
(or another available hook type) withimport type { OnCreateAppSync } from 'vike-vue/hooks'