question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need ability to disable in development

See original GitHub issue

I don’t see a config to disable this module in development. Current workaround is to set the env var as UA-000000-1, but this is not ideal.

With missing GA code, the following error returns in development:

client.js:533 [nuxt] Error while initializing app Error: [vue-analytics] Please enter a Google Analytics tracking ID
    at A (http://localhost:3000/_nuxt/vendor.js:19078:4201)
    at I (http://localhost:3000/_nuxt/vendor.js:19078:5605)
    at Function.Vue.use (http://localhost:3000/_nuxt/vendor.js:28179:14)
    at _callee$ (http://localhost:3000/_nuxt/app.js:1270:58)
    at tryCatch (http://localhost:3000/_nuxt/vendor.js:2017:40)
    at Generator.invoke [as _invoke] (http://localhost:3000/_nuxt/vendor.js:2251:22)
    at Generator.prototype.(anonymous function) [as next] (http://localhost:3000/_nuxt/vendor.js:2069:21)
    at step (http://localhost:3000/_nuxt/vendor.js:1832:30)
    at http://localhost:3000/_nuxt/vendor.js:1850:14
    at new Promise (<anonymous>)
<div align="right">This question is available on Nuxt.js community (#c9)</div>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
lukas-piercecommented, Oct 28, 2018

you can use spread ... operator

const isProd = process.env.NODE_ENV === 'production';
const analyticsModule = isProd ?  ['@nuxtjs/google-analytics', {id: 'YOUR-TRACKING-ID'}] : null;

modules: [
  //other modules
  ...(analyticsModule ? [analyticsModule] : [])
  //other modules
]
0reactions
robyedlincommented, Mar 25, 2018

👍 You can also use @MatteoGabriele 's suggestion: https://github.com/nuxt-community/analytics-module/issues/10#issuecomment-370054625, but I prefer not to fiddle with the config in this case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Need ability to disable in development · Issue #10 - GitHub
I don't see a config to disable this module in development. Current workaround is to set the env var as UA-000000-1, but this...
Read more >
Disable Code Like Magic With Feature Flags - CloudBees
Disable code in production without touching it. Sound like magic? It's not: gain that power by adopting feature flags.
Read more >
Ability to disable the Development Panel for specific project
The suggestion is to add the ability to disable the Development Panel for specific projects, e.g. projects not related to Development.
Read more >
Android Basics: 10 settings to instantly disable on your phone
To disable this you'll need to head to Settings > System > Developer options > Mobile data is always active > Toggle off....
Read more >
Mainstreaming disability in the development agenda
Efforts to incorporate and include persons with disabilities into the development activities have been gaining momentum over the past several decades. The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found