Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

116
Vistas
Guessjs - How to get routes and probabilities with guess-webpack and guess-webpack/api in vuejs?

I have run:

npm i guess-webpack

In my webpack.mix.js I have:

const { GuessPlugin } = require('guess-webpack');

mix.webpackConfig({
plugins: [
new GuessPlugin({
    GA: '123456789',
    jwt: {
        private_key: "-----BEGIN PRIVATE KEY-----\nSomething!!!\n-----END PRIVATE KEY-----\n",
        client_email: "example@example.com",
    },
    //debug: true,
    runtime: {
        delegate: false
    }
}),

Till now, it is working and when I uncomment the debug: true, it returns all the routes and probabilities like so:

Initial mapping between routes and probability
{
    "/": [{
        "route": "/example-1",
        "probability": 0.16031746031746033
    }, {
        "route": "/example-2",
        "probability": 0.10031746031746033
    }]
    ...
    ...
    ...
}

But now the problem is that when I want to get the data from guess() function which is inside guess-webpack/api into my vue application in order to get the routes and probabilities, it returns:

[Vue warn]: Error in mounted hook: "TypeError: (intermediate value).__GUESS__ is undefined"
.
.
.
TypeError: (intermediate value).__GUESS__ is undefined

My code that generates the above error is:

import Vue from 'vue';

new Vue({
el: '#app',
data() {
    return {}
},
mounted() {
    const { guess } = require('guess-webpack/api');
    if (typeof window !== 'undefined') {
        console.log(guess()); //This is undefined!
    }
}

I have access to `__GUESS__` and its method which is `p` in my console but when I run `__GUESS__.p()`, it returns `undefined`.

What's inside guess-webpack/api:

export const guess = (params: any) =>
  ((typeof window === 'undefined' ? global : window) as any).__GUESS__.guess(params);

How to get routes and probabilities with guess-webpack and guess-webpack/api in vuejs?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda