question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[guess-parser] Is not support Nextjs?

See original GitHub issue

Expect behavior

  • Configure guess.js configuration using by guess-webpack and guess-parser
  • run next build
  • guess.js works well

Actual behavior

When we run next build, we’ll get this error.

$ next build && next export
(node:57565) UnhandledPromiseRejectionWarning: Error: Cannot detect the application type
    at exports.parseRoutes (/Users/development/next-app/node_modules/guess-parser/dist/guess-parser/index.js:860:15)

Issue

I’ve checked the code, I think the guess-parser does not support nextjs.

https://github.com/guess-js/guess/blob/3c55310899f601aeedfa483db571de905b6c8797/packages/guess-parser/src/detector/detect.ts

Is it possible to support Nextjs?

I think we need the following conditions, isn’t it?

  if (d('react') && d('next') {
    return { ...ANY_CONFIG };
  }
  if (d('react') && d('next') && exists('tsconfig.json')) {
    return { ...ANY_CONFIG };
  }

Thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mgechevcommented, Apr 11, 2020

Yes, you are correct. The parser does not support Next.js which means that you can’t take advantage of the ahead of time prefetching of Guess.js. At the same time, you can embed the prefetching instructions for your entire application as part of your main bundle. This way you can enable predictive prefetching for your Next.js app.

1reaction
mgechevcommented, Apr 11, 2020

You can find a demo with Next.js here https://github.com/mgechev/guess-next.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supported Browsers and Features - Next.js
Supported Browsers and Features. Next.js supports modern browsers with zero configuration. Chrome 64+; Edge 79+; Firefox 67+; Opera 51+; Safari 12+ ...
Read more >
Advanced Features: Next.js Compiler
This flag is only supported for compatibility with existing applications. We do not recommend using legacy decorators in new applications. First, update to...
Read more >
Advanced Features: Turbopack | Next.js
Supported Features. To learn more about the currently supported features for Turbopack, view the documentation. Next.js CompilerPreview Mode ...
Read more >
Advanced Features: Custom `Document` - Next.js
This new directory has support for layouts, nested routes, and uses Server ... Document currently does not support Next.js Data Fetching methods like ......
Read more >
Blog - Next.js 13
The app/ directory introduces support for React's new Server Components ... During the alpha, many features are not yet supported.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found