[Bug report] plugin-baidu-analytics `Uncaught (in promise) Error: useClientData() is called without provider.` on production
typed-sigterm opened this issue · comments
Description
When on production, plugin-baidu-analytics complains Uncaught (in promise) Error: useClientData() is called without provider.
and doesn't load script.
Reproduction
https://stackblitz.com/edit/vuepress-demo-19211d7
To reproduce:
pnpm install && pnpm build && pnpm preview
Used Package Manager
pnpm
System Info
System:
OS: Windows 11 10.0.22621
CPU: (6) x64 AMD Ryzen 5 4500U with Radeon Graphics
Memory: 1.16 GB / 7.23 GB
Binaries:
Node: 20.10.0 - C:\nodejs\node.EXE
Yarn: 1.22.22 - ~\AppData\Local\pnpm\yarn.CMD
npm: 10.2.3 - C:\nodejs\npm.CMD
pnpm: 8.15.3 - ~\AppData\Local\pnpm\pnpm.CMD
bun: Not Found
Utilities:
Git: 2.37.3.
Browsers:
Chrome: Not Found
Edge: Chromium (122.0.2365.92), ChromiumDev (123.0.2420.10)
npmPackages:
@vuepress/bundler-vite: 2.0.0-rc.8 => 2.0.0-rc.8
@vuepress/bundler-webpack: Not Found
@vuepress/cli: Not Found
@vuepress/client: Not Found
@vuepress/core: Not Found
@vuepress/markdown: Not Found
@vuepress/shared: Not Found
@vuepress/utils: Not Found
vue: ^3.4.21 => 3.4.21
vue-router: Not Found
vuepress: 2.0.0-rc.8 => 2.0.0-rc.8
Hello @Zihan-Hu. This issue is marked as invalid
and closed. Please follow the issue template.
@Mister-Hope updated to plugin version 2.0.0-rc.21
and core version 2.0.0-rc.9
(see reproduction), but the problem still appeared
ping? This error is caused by
Plugins was loaded outside a component, so a plugin can't access injected value
https://github.com/vuepress/core/blob/dbebec008362af91b907f5f9aa0d19fee981dbd7/packages/client/src/composables/clientData.ts#L16