Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Next.js v8 #274

Closed
jaydenseric opened this issue Jan 9, 2019 · 7 comments · Fixed by vercel/next.js#6019
Closed

Support Next.js v8 #274

jaydenseric opened this issue Jan 9, 2019 · 7 comments · Fixed by vercel/next.js#6019

Comments

@jaydenseric
Copy link

jaydenseric commented Jan 9, 2019

next-routes imports from next/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:

[redacted]/node_modules/next/dist/client/link.js:2
import { resolve, format, parse } from 'url';
       ^

SyntaxError: Unexpected token {

Presumably import NextRouter from 'next/router' would have the same issue.

@jaydenseric
Copy link
Author

@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.

@timneutkens
Copy link

timneutkens commented Jan 9, 2019

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.

timneutkens added a commit to vercel/next.js that referenced this issue Jan 11, 2019
Because next-routes requires APIs outside of compilation we have to compile these

Fixes fridays/next-routes#274
Fixes #6017
@EduardoHidalgo
Copy link

this issue was fixed by 8.0.0-canary.7 (: i validated.

@amankakar
Copy link

thank @EduardoHidalgo you have saved my day..

@fridays
Copy link
Owner

fridays commented Feb 7, 2019

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

@corysimmons
Copy link

Can this be closed since it works in 8?

@EduardoHidalgo
Copy link

Yes 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants