Closed jaydenseric closed 5 years ago
@timneutkens would you consider this a Next.js v8 bug?
Side note; you can ship ESM and CJS side by side using .js
/.mjs
, and Webpack (along with Node.js in --experimental-modules
mode) will resolve the .mjs
file first.
This is still on my list of things to fix on the Next.js side. However next-routes is importing next/link inside the custom server, which is slightly weird/wrong anyway.
this issue was fixed by 8.0.0-canary.7 (: i validated.
thank @EduardoHidalgo you have saved my day..
Thank you! Yeah Link in the custom server doesn't make sense, it's not used there at all, it's just in the same file. PR welcome
Can this be closed since it works in 8?
Yes 😀
next-routes
imports fromnext/link
:https://github.com/fridays/next-routes/blob/1.4.2/src/index.js#L4
But in Next.js v8.0.0-canary.3 that file contains ESM, presumably because Next.js expects it will always be imported within a Next.js project via a Webpack build:
https://unpkg.com/next@8.0.0-canary.3/dist/client/link.js
That causes this runtime error on the server:
Presumably
import NextRouter from 'next/router'
would have the same issue.