guess: Cannot read property 'guess' of undefined

am trying to use guess with laravel through a pre-defined routes file like in nuxt example so the setup is

  • guess-routes.json ex.
{
    "\/": {
        "\/login": 2,
        "\/about": 1
    },
    "\/about": {
        "\/contact-us": 1
    },
    "\/contact-us": {
        "\/": 1
    }
}
  • webpack
const {readFileSync} = require('fs')
const {GuessPlugin} = require('guess-webpack')

mix.webpackConfig({
    plugins: [
        new GuessPlugin({
            reportProvider() {
                return Promise.resolve(JSON.parse(readFileSync('./guess-routes.json')))
            }
        })
    ]
})
  • app.js
import {guess} from 'guess-webpack/api'
guess()
  • error demo

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 17 (3 by maintainers)

Most upvoted comments

hi @daliborgogic , after I disabled the pwa and remove all the cache the error seems to be gone, I guess it was the previous cached js caused the issue. Thanks for the help!!