Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adsbygoogle is not defined #143

Closed
YankeeTube opened this issue Oct 9, 2020 · 7 comments · Fixed by #144 or nuxt-modules/google-adsense#68
Closed

adsbygoogle is not defined #143

YankeeTube opened this issue Oct 9, 2020 · 7 comments · Fixed by #144 or nuxt-modules/google-adsense#68
Labels
type: bug Something isn't working

Comments

@YankeeTube
Copy link

image

i used
nuxtjs version is 2.14.5
@nuxtjs/storybook version is 2.2.2

console error message
image

Is there any way to use @nuxtjs/Google-Adsense in the @nuxtjs/storybook?

@YankeeTube YankeeTube added the type: bug Something isn't working label Oct 9, 2020
@farnabaz
Copy link
Collaborator

farnabaz commented Oct 9, 2020

Could you provide a reproduction sample on codesandbox?

@YankeeTube
Copy link
Author

@farnabaz

preview.js

import '~~/.nuxt-storybook/storybook/preview.js'

import Vuetify from 'vuetify'
import colors from 'vuetify/es5/util/colors'
import 'vuetify/dist/vuetify.min.css' // all the css for components

const vuetifyConfig = new Vuetify({
  customVariables: ['~/assets/variables.scss'],
  optionsPath: './vuetify.options.js',
  treeShake: true,
  theme: {
    dark: false,
    themes: {
      dark: {
        teal: colors.amber,
        primary: colors.blue.darken2,
        accent: colors.grey.darken3,
        secondary: colors.amber.darken3,
        info: colors.teal.lighten1,
        warning: colors.amber.base,
        error: colors.deepOrange.accent4,
        success: colors.green.accent3
      }
    }
  }
})

export const decorators = [
  (_) => {
    return {
      vuetify: vuetifyConfig,
      template: `
        <v-app>
        <v-main>
          <v-container fluid>
            <story />
          </v-container>
        </v-main>
        </v-app>`
    }
  }
]

main.js

module.exports = {
  webpackFinal (config, options) {
    config = options.nuxtStorybookConfig.webpackFinal(config, options)
    // extend config
    return config
  },
  stories: ['../components/**/*.stories.@(ts|js)'],
  addons: ['@storybook/addon-knobs', '@storybook/addon-viewport'],
}

But I'm not declaring an google-adsense in the stories file.
only used index page

@YankeeTube
Copy link
Author

nuxt.config.js - module

modules: [
    // https://go.nuxtjs.dev/pwa
    '@nuxtjs/pwa',
    [
      '@nuxtjs/google-adsense',
      {
        id: `ca-pub-${process.env.ADSENSE_KEY}`
      }
    ]
  ],

@farnabaz
Copy link
Collaborator

farnabaz commented Oct 9, 2020

I see,
We need to update both @nuxtjs/google-adsense and @nuxtjs/storybook module

@YankeeTube
Copy link
Author

YankeeTube commented Oct 9, 2020

Oh, so is there no other way but to wait until the update is done?
Even if we set the

// nuxt.config.js
storybook: {
  modules: false,
  ...
}

the phenomenon continues...

@farnabaz
Copy link
Collaborator

farnabaz commented Oct 9, 2020

The only workaround before the update is to remove @nuxtjs/google-adsense.

@YankeeTube
Copy link
Author

ㅜㅜ Thank you for your help. I hope it will be updated soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
2 participants