You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's not really a 'feature', more a 'documentation' request, about how to use external libs inside vuepress.
What problem does this feature solve?
I'm trying to integrate Matomo (ex piwik) instead of Google Analytics.
So I'm using vue-matomo inside the .vuepress/enhancedApp.js, because I think it's the good place to use it.
It looks like this :
importVueMatomofrom'vue-matomo';exportdefault({
Vue,// the version of Vue being used in the VuePress app
options,// the options for the root Vue instance
router,// the router instance for the app
siteData // site metadata})=>{// ...apply enhancements to the appVue.use(VueMatomo,{host: 'https://piwik.yourwebsite.com',siteId: 1,// Enables automatically registering pageviews on the routerrouter: router,// Require consent before sending tracking information to matomorequireConsent: true})}
In local dev, seems ok, calls are made to the matomo server automatically if I disable requireConsent.
But when I build with vuepress build, it seems that vuepress cannot access my local dependency, because vue-matomo directory is a sibling of the vuepress dir.
import VueMatomo from '../node_modules/vue-matomo/dist/vue-matomo.esm';
and now, the build seems better, but crash for the server part with a
Rendering page: /404.htmlError loading script ReferenceError: document is not defined
at server-bundle.js:5315:18
at new Promise (<anonymous>)
at bootstrap (server-bundle.js:5314:23)
I think it's about SSR, maybe document is unavailable when vuepress build the server part. So it's not a vuepress problem anymore. (except if we think it's a good thing to allow user to choose between GA / Matomo)
How should this be implemented in your opinion?
Before that, some questions from me :
do you agree the file enhanceApp.js is the right place for that ?
do you agree the local import is the right solution ?
If yes, I think new section in the documentation telling us how to install a dependency and make available for vuepress to use it would be ok.
Are you willing to work on this yourself?**
Why not.
The text was updated successfully, but these errors were encountered:
do you agree the file enhanceApp.js is the right place for that ?
Yes
do you agree the local import is the right solution ?
No, you just need:
importVueMatomofrom'vue-matomo'
because vue-matomo directory is a sibling of the vuepress dir.
Emmm... module resolution depends on the location of your enhanceApp instead of VuePress's dir.
Closing it since there is no any valid reproduction repo link. If it turns out to be a bug, come back and open an issue with a proper reproduction repo.
Feature request
It's not really a 'feature', more a 'documentation' request, about how to use external libs inside vuepress.
What problem does this feature solve?
I'm trying to integrate Matomo (ex piwik) instead of Google Analytics.
So I'm using vue-matomo inside the
.vuepress/enhancedApp.js
, because I think it's the good place to use it.It looks like this :
In local dev, seems ok, calls are made to the matomo server automatically if I disable
requireConsent
.But when I build with
vuepress build
, it seems thatvuepress
cannot access my local dependency, because vue-matomo directory is a sibling of thevuepress
dir.I try a local import like this
and now, the build seems better, but crash for the server part with a
I think it's about SSR, maybe
document
is unavailable when vuepress build the server part. So it's not avuepress
problem anymore. (except if we think it's a good thing to allow user to choose between GA / Matomo)How should this be implemented in your opinion?
Before that, some questions from me :
enhanceApp.js
is the right place for that ?If yes, I think new section in the documentation telling us how to install a dependency and make available for vuepress to use it would be ok.
Are you willing to work on this yourself?**
Why not.
The text was updated successfully, but these errors were encountered: