Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!