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

feat(Next.JS): Support server-side Next.JS usage #220

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

thaddeusdiamond
Copy link
Contributor

Next.JS disallows relative imports since 12.0.1 (see https://nextjs.org/docs/messages/middleware-relative-urls for more information). So, we need to sniff out if we are in the NEXTJS environment and if so, use the fallback URL.

This should resolve:
#174

[ Testing: deno task build ]

@thaddeusdiamond
Copy link
Contributor Author

Hold on this is now not working... it was before. Investigating.

@thaddeusdiamond
Copy link
Contributor Author

@alessandrokonrad this change works when I build it off of 0.9.8 (as you recommended in the original ticket), but not off of 0.10.7. Any reason why that would be? How do you want to address this, publishing an npm patch called 0.9.8-nextjs?

Next.JS disallows relative imports since 12.0.1 (see
https://nextjs.org/docs/messages/middleware-relative-urls for more
information).  So, we need to sniff out if we are in the NEXTJS
environment and if so, use the fallback URL.

This should resolve:
spacebudz#174

[ Testing: deno task build ]
@Rithista
Copy link

@thaddeusdiamond Followup on this PR, tested this PR in a test/production app and works as indended. Would strongly recommend this gets merged, otherwise other next users will fall into the rabbit hole of why certain .wasm functions break and its tricky to debug without going into the module code. Next is now more heavily server-side than before so I expect more users to run into this issue.

Merge Latest Conway Changes
Ideally we would want to use the paradigm that the build process set out
to pull from a local lib, but we can't for NextJS.  Since this is a
fork, we don't need to worry about a circular dependency (the fork will
pull from the main).  Without this, NextJS splits the libraries into
chunks and the path resolution fails.

[ Testing: npm i lucid-cardano-nextjs@0.10.10-b4 ]
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 this pull request may close these issues.

2 participants