Skip to content

[Bug report] HMR of vue components with usePageData() errros #1154

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

Closed
psi-4ward opened this issue Nov 5, 2022 · 0 comments
Closed

[Bug report] HMR of vue components with usePageData() errros #1154

psi-4ward opened this issue Nov 5, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@psi-4ward
Copy link

Description

  1. Add registerComponentsPlugin
  plugins: [
    registerComponentsPlugin({
      componentsDir: path.resolve(__dirname, '../../components'),
    }),
  ],
  1. Add a component with usePageData()
<template>
  <div>
    aa
    <pre>{{ pageData }}</pre>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { usePageData } from '@vuepress/client';

export default defineComponent({
  setup() {
    return {
      pageData: usePageData()
    };
  },
});
</script>
  1. Put it in a md-page

  2. Edit the component

client.ts:113 TypeError: defineClientConfig is not a function
    at config.js?t=1667648196081&v=987cdd9b:7:16
warnFailedFetch @ client:264
fetchUpdate @ client:506
await in fetchUpdate (async)
(anonymous) @ client:306
handleMessage @ client:304
(anonymous) @ client:246
dispatchEvent @ .localservice@runtime.a0ea75dd36396805bd36e49d0b54d86602583e15.js:1
_handleMessage @ .localservice@runtime.a0ea75dd36396805bd36e49d0b54d86602583e15.js:7
_0x2dff07 @ .localservice@runtime.a0ea75dd36396805bd36e49d0b54d86602583e15.js:7

client.ts:115 [hmr] Failed to reload /@fs/home/projects/vuepress-uy4riu/components/MyComp.vue. This could be due to syntax errors or importing non-existent modules. (see errors above)

Reproduction

https://stackblitz.com/edit/vuepress-uy4riu?file=docs%2F.vuepress%2Fconfig.ts,components%2FMyComp.vue,docs%2FREADME.md

Used Package Manager

npm

System Info

./node_modules/.bin/vuepress info

  System:
    OS: Linux 5.0 undefined
    CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  Utilities:
    Git: Not Found
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @vuepress/bundler-vite:  2.0.0-beta.53 
    @vuepress/bundler-webpack: Not Found
    @vuepress/cli:  2.0.0-beta.53 
    @vuepress/client:  2.0.0-beta.53 
    @vuepress/core:  2.0.0-beta.53 
    @vuepress/markdown:  2.0.0-beta.53 
    @vuepress/plugin-active-header-links:  2.0.0-beta.53 
    @vuepress/plugin-back-to-top:  2.0.0-beta.53 
    @vuepress/plugin-container:  2.0.0-beta.53 
    @vuepress/plugin-docsearch: Not Found
    @vuepress/plugin-external-link-icon:  2.0.0-beta.53 
    @vuepress/plugin-git:  2.0.0-beta.53 
    @vuepress/plugin-google-analytics: Not Found
    @vuepress/plugin-medium-zoom:  2.0.0-beta.53 
    @vuepress/plugin-nprogress:  2.0.0-beta.53 
    @vuepress/plugin-palette:  2.0.0-beta.53 
    @vuepress/plugin-prismjs:  2.0.0-beta.53 
    @vuepress/plugin-pwa: Not Found
    @vuepress/plugin-pwa-popup: Not Found
    @vuepress/plugin-register-components: ^2.0.0-beta.53 => 2.0.0-beta.53 
    @vuepress/plugin-search: Not Found
    @vuepress/plugin-shiki: Not Found
    @vuepress/plugin-theme-data:  2.0.0-beta.53 
    @vuepress/plugin-toc: Not Found
    @vuepress/shared:  2.0.0-beta.53 
    @vuepress/theme-default:  2.0.0-beta.53 
    @vuepress/utils:  2.0.0-beta.53 
    vue:  3.2.41 
    vue-loader: Not Found
    vue-router:  4.1.6 
    vuepress: ^2.0.0-beta.53 => 2.0.0-beta.53 
    vuepress-vite:  2.0.0-beta.53 
    vuepress-webpack: Not Found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants