vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.17k stars 923 forks source link

Vuepress dev fails to start when using the vite bundler. #136

Closed MichMich closed 3 years ago

MichMich commented 3 years ago

Bug report

Description

When trying to start vuepress dev using the vite bundler, the application crashes with a type error:

TypeError: app.pluginApi.hooks.define.processSync is not a function
    at Object.resolveDefine (/Users/Michael/Code/vuepress-vite-error/node_modules/@vuepress/bundler-vite/lib/plugin/resolveDefine.js:15:53)
    at Object.config (/Users/Michael/Code/vuepress-vite-error/node_modules/@vuepress/bundler-vite/lib/plugin/createPlugin.js:20:37)
    at resolveConfig (/Users/Michael/Code/vuepress-vite-error/node_modules/vite/dist/node/chunks/dep-efbff8d5.js:69709:33)
    at async Object.createServer (/Users/Michael/Code/vuepress-vite-error/node_modules/vite/dist/node/chunks/dep-efbff8d5.js:68238:20)
    at async Object.dev (/Users/Michael/Code/vuepress-vite-error/node_modules/@vuepress/bundler-vite/lib/dev/createDev.js:8:20)
    at async dev (/Users/Michael/Code/vuepress-vite-error/node_modules/@vuepress/cli/lib/commands/dev/dev.js:48:19)

Steps to reproduce

git clone git@github.com:MichMich/vuepress2-vite-bundler-error.git
cd vuepress2-vite-bundler-error
npm install
npm run dev

Expected behavior

I expect the bundler successfully run and start the webserver.

Screenshots

Screenshot 2021-05-14 at 15 37 26

Environment info

> vuepress-vite-error-example@1.0.0 info
> vuepress info

  System:
    OS: macOS 11.2.3
    CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
    Memory: 508.10 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.17.0 - /usr/local/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 7.12.0 - /usr/local/bin/npm
  Utilities:
    Git: 2.30.1 - /usr/bin/git
  Browsers:
    Chrome: 90.0.4430.212
    Edge: Not Found
    Firefox: 86.0
    Safari: 14.0.3
  npmPackages:
    @vuepress/bundler-vite:  2.0.0-beta.6 
    @vuepress/bundler-webpack:  2.0.0-beta.14 
    @vuepress/cli:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/client:  2.0.0-beta.12 (2.0.0-beta.6)
    @vuepress/core:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/markdown:  2.0.0-beta.13 (2.0.0-beta.5)
    @vuepress/plugin-active-header-links:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-back-to-top:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-container:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-debug: Not Found
    @vuepress/plugin-docsearch: Not Found
    @vuepress/plugin-git:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-google-analytics: Not Found
    @vuepress/plugin-medium-zoom:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-nprogress:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-palette:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-prismjs:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-pwa: Not Found
    @vuepress/plugin-pwa-popup: Not Found
    @vuepress/plugin-register-components: Not Found
    @vuepress/plugin-search: Not Found
    @vuepress/plugin-shiki: Not Found
    @vuepress/plugin-theme-data:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/plugin-toc: Not Found
    @vuepress/shared:  2.0.0-beta.7 (2.0.0-beta.4)
    @vuepress/theme-default:  2.0.0-beta.14 (2.0.0-beta.6)
    @vuepress/theme-vue: Not Found
    @vuepress/utils:  2.0.0-beta.11 (2.0.0-beta.5)
    vue:  3.0.11 
    vue-loader:  16.2.0 
    vue-router:  4.0.8 
    vuepress: ^2.0.0-beta.14 => 2.0.0-beta.14 
    vuepress-vite: * => 2.0.0-beta.6 
meteorlxy commented 3 years ago

Please upgrade to the latest version.

Current:

https://github.com/vuepress/vuepress-next/blob/fad1cfd02d3247306b0fe6c1b5fa09a7faa292ea/packages/vuepress-vite/package.json#L3

Yours:

vuepress-vite: * => 2.0.0-beta.6 
MichMich commented 3 years ago

Thanks. Should have figured that out myself. 🤦🏻‍♂️