web-vitals icon indicating copy to clipboard operation
web-vitals copied to clipboard

feat(nuxt3): rewrite with nuxt kit

Open Baroshem opened this issue 3 years ago • 7 comments
trafficstars

In this PR I wanted to introduce some Breaking Changes for the configuration of the module for both Google Analytics and Vercel Analytics.

I wanted to add both these variables as a part of the module config options like this:

interface ModuleOptions {
  provider: 'log' | 'vercel' | 'ga';
  debug: boolean;
  disabled: boolean;
  options: {
    googleMeasurementId: '123test',  // <- for Google Analytics
    vercelAnalyticsDsn: '123test'  // <- for Vercel Analytics
  }
}

Apart from that, no other BC are introduced in the migration and the module should work for all nuxt.js projects due to usage of module-builder.

Baroshem avatar Mar 29 '22 09:03 Baroshem

@pi0 @Atinux @danielroe I have added all recommendations from you :)

Baroshem avatar Jul 01 '22 10:07 Baroshem

@pi0 @Atinux @danielroe

I have updated the PR with the recent recommendations.

Baroshem avatar Jul 06 '22 11:07 Baroshem

Would be nice to have an edge release in order to try it out :)

atinux avatar Jul 11 '22 11:07 atinux

@Atinux Could you explain what do you mean about edge release?

I just created a PR with a update to Nuxt 3 so i dont have access to deploy the package. I believe it would be up to @pi0 to do that

Baroshem avatar Jul 21 '22 12:07 Baroshem

I was thinking that you could try to release on a nuxt-webvitals-module to try it for example.

Do you mind resolving the conflicts @Baroshem ?

atinux avatar Aug 03 '22 10:08 atinux

Current module should be compatible with Nuxt 3. I'm holding on this PR to properly test for Nuxt 3 and Nuxt 2 compatibility (vercel auto installs this module on deployments) and also check provider resolution changes.

pi0 avatar Aug 03 '22 10:08 pi0

This is why I was thinking of an edge deployment to test on Vercel for example on one of our Nuxt 3 projects, how to test it otherwise?

atinux avatar Aug 03 '22 11:08 atinux

Hi guys, any updates on this one?

AndrewBogdanovTSS avatar Nov 02 '22 08:11 AndrewBogdanovTSS

So far the module is working also on Nuxt 3.

I would personally vote to have a branch for Nuxt 2 and another one for Nuxt 3 for simplicity.

atinux avatar Nov 02 '22 10:11 atinux

@Baroshem I reworked migration to kit with 3.0.0 compatibility in #59 to be without breaking changes and remain nuxt 2 compatible (mainly because vercel is injecting this module automatically).

Your PR included some more changes and type improvements that were conflicting. Feel free to rework them as smaller PRs and thanks again for time spent on this migration ❤️

pi0 avatar Nov 28 '22 15:11 pi0