nuxt-community/google-analytics-module

why buildModules instead of modules ?

vesper8 opened this issue · 2 comments

I'm just trying to understand the logic why this module needs to be inside buildModules instead of modules ? It seems that buildModules is generalyl designed for things that only occur during the build, yet something like google analytics which (I would imagine) can execute code on every route change doesn't feel like it should be a "build-only" module ?

Hey @vesper8 , if you look the source code, you notice 2 files there, a module and a plugin.

Declaring it as a buildModule means that the module will run only in build time, however, since the module adds a plugin, which is by design, something meant for runtime.

I may be wrong, but think that by doing this, the workload in production pages is reduced, since at least one step is cut off.