guess: TypeError: Cannot read property 'eagerRoutes' of undefined
Can´t read property ‘eagerRoutes’ of undefined
My extend.webpack.config.js is like below:
const { GuessPlugin } = require('guess-webpack');
const { parseRoutes } = require('guess-parser');
module.exports = {
plugins: [
new GuessPlugin({
GA: '<GAV Id>',
runtime: {
delegate: false
},
routeProvider() {
return parseRoutes('.');
}
})
]
};
But I get this error when I run the ng build --prod command.
(node:1672) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'eagerRoutes' of undefined
at collectRoutingModules (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\guess-parser\dist\guess-parser\index.js:465:17)
at processLazyRoute (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\guess-parser\dist\guess-parser\index.js:463:9)
at Array.forEach (<anonymous>)
at collectRoutingModules (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\guess-parser\dist\guess-parser\index.js:466:28)
at Object.exports.parseRoutes (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\guess-parser\dist\guess-parser\index.js:598:9)
at exports.parseRoutes (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\guess-parser\dist\guess-parser\index.js:843:28)
at Object.routeProvider (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\extend.webpack.config.js:16:16)
at extractRoutes (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\guess-webpack\dist\guess-webpack\main.js:457:39)
at GuessPlugin._execute (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\guess-webpack\dist\guess-webpack\main.js:490:9)
at C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\guess-webpack\dist\guess-webpack\main.js:486:54
at _next0 (eval at create (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:13:1)
at eval (eval at create (C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:28:1)
at C:\Users\aleja\OneDrive\Documents\Cursos\Angular\platzi-store\node_modules\copy-webpack-plugin\dist\index.js:91:9
(node:1672) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1672) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Don't fail when a child module has no route declarations Fix #311 — committed to guess-js/guess by mgechev 4 years ago
- Don't fail when a child module has no route declarations Fix #311 — committed to guess-js/guess by mgechev 4 years ago
- Don't fail when a child module has no route declarations (#312) Fix #311 — committed to guess-js/guess by mgechev 4 years ago
Unfortunately, there’s nothing I can do at this point. You can generate JWT tokens and provide them to Guess.js in a similar way I did here.
Not sure what the text says. Would you translate?
Fixed in https://github.com/guess-js/guess/pull/312. Let me know when you verify so I can release the fix.
Guess.js gets confused because you don’t have route declarations in
about-routing.module.ts, which makes sense, but still the failure should not happen.Until I push a fix, you can workaround the problem by replacing your
about-routing.module.tswith:Just found the public repo in your account and reproduced the problem. I’ll see what I can find.