Next.js: Navigation not working on electron.js + next.js

Created on 26 Aug 2020  路  3Comments  路  Source: vercel/next.js

Bug report

Describe the bug

When trying to navigate to a different page using next.js+ typescript + electron the click over the link does nothing

To Reproduce

  1. Download next.js with-electron-typescript example https://github.com/vercel/next.js/tree/canary/examples/with-electron-typescript
  2. Install modules: with-electron-typescript$ yarn
  3. Pack app: with-electron-typescript$ yarn pack-app
  4. Go to with-electron-typescript/dist/win-unpacked
  5. Execute (double click) ElectronTypescriptNext.exe
  6. Try to navigate to Home, About and With Initial Props

Expected behavior

The application should navigate to the specified page:

Click on home -- navigate to --> pages/home
Click on about -- navigate to --> pages/about
...and so on.

Screenshots

The links seems to be rendered properly, linking to file:///
image

the src of the scripts is /_next/... (file:///_next/...)
image

But if I go to Sources tab then it shows that the _next/ resources are under C://
image

Shouldn't the scripts' src in the first picture link to /C://_next/... instead of /_next/... to get file:///C:/_next/...?

System information

  • OS: Windows 10
  • Version of Electron.js: 7.1.7
  • Version of Next.js: 9.5.2 (latest)
  • Version of Node.js: 12.16.2
  • Version of yarn: 1.15.2

Additional context

  1. I tried using <base href="./" /> but it does not solve the routing issue because base tag does not work with absolute paths (like /about, /_next/) but with relative ones (./about, ./_next/)
  2. next.config.js basePath does not allow relative paths, so you cannot do basePath: './' to transform /about --> ./about
  3. Even tried with the "import empty css" hack https://github.com/vercel/next.js/issues/5203#issuecomment-423403716
good first issue bug

Most helpful comment

As in #16456, downgrading to [email protected] worked for me.

All 3 comments

Hi! I'm interested in this issue 鈽猴笍

As in #16456, downgrading to [email protected] worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DvirSh picture DvirSh  路  3Comments

jesselee34 picture jesselee34  路  3Comments

havefive picture havefive  路  3Comments

kenji4569 picture kenji4569  路  3Comments

rauchg picture rauchg  路  3Comments