moritzsternemann / vue-plausible

Plausible Analytics Vue.js Plugin and NuxtJS Module
MIT License
120 stars 8 forks source link

fix: inject esm plugin in nuxt environment #7

Closed danielroe closed 3 years ago

danielroe commented 3 years ago

There should be no need to inject a CJS plugin as Nuxt will already be transpiling files in .nuxt - and this way, we can be compatible with nuxt-vite 🥳

If you'd like, I can also make this properly esm/pnp compatible by adding exports field in package.json and using require.resolve, but didn't want to conflate the issues.

moritzsternemann commented 3 years ago

Hey thanks for the contribution @danielroe!

I haven't used the exports in package.json yet. I'd love to know what's wrong/bad about my current approach and how it can be improved. Feel free to open another PR!