Skip to content

patch node-module-loader dynamic require #431

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

Merged
merged 9 commits into from
Mar 3, 2025

Conversation

HyperKiko
Copy link
Contributor

should fix #380

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

changeset-bot bot commented Mar 1, 2025

🦋 Changeset detected

Latest commit: df638ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

I added minor comments but what's this is really lacking is a test in e2e/pages-router. Can you please add one?

@HyperKiko
Copy link
Contributor Author

Thanks for the PR.

I added minor comments but what's this is really lacking is a test in e2e/pages-router. Can you please add one?

i'm not quite sure how i'd go about doing that. should i just create a test that fetches the api route and checks that the response was successful?

@vicb
Copy link
Contributor

vicb commented Mar 1, 2025

i'm not quite sure how i'd go about doing that. should i just create a test that fetches the api route and checks that the response was successful?

That sounds great.
We have examples in the playground tests if needed.

Copy link

pkg-pr-new bot commented Mar 1, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@431

commit: df638ff

@vicb
Copy link
Contributor

vicb commented Mar 1, 2025

Maybe you can also move the 2 patches in the same file as they are very closely related. It will probably allow to factor some code too.

@HyperKiko
Copy link
Contributor Author

if you don't have any more comments could this get merged?

@vicb
Copy link
Contributor

vicb commented Mar 2, 2025

if you don't have any more comments could this get merged?

Have you tried the build of the adapter attached to this PR and can confirm it fixed your issue?

Thanks for your work on the fix!

@vicb
Copy link
Contributor

vicb commented Mar 2, 2025

If everything works as expected, please add a patch changeset (pnpm changeset and follow the prompt)

@vicb
Copy link
Contributor

vicb commented Mar 2, 2025

Use pnpm fix to format the coffee but it looks like there are legit errors to fix first

@HyperKiko
Copy link
Contributor Author

HyperKiko commented Mar 2, 2025

Use pnpm fix to format the coffee but it looks like there are legit errors to fix first

should be fixed now, seems like it was because of yaml not being as generous with whitespace, could you rerun the checks/workflows? i'll test it on my app with pkg.pr.new

@vicb
Copy link
Contributor

vicb commented Mar 2, 2025

Use pnpm e2e to run the tests locally, formatting still looks off

@HyperKiko
Copy link
Contributor Author

Use pnpm e2e to run the tests locally, formatting still looks off

should be good to go now. the issue was that patchCode parses as typescript instead of javascript, which slightly changes the output. i just modified the rule. not sure why that's the case, though, since it should always be parsing prebuilt code

@vicb vicb force-pushed the patch-node-module-loader branch from e2fe39d to df638ff Compare March 3, 2025 07:49
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@vicb vicb merged commit 9ad6714 into opennextjs:main Mar 3, 2025
7 checks passed
@HyperKiko HyperKiko deleted the patch-node-module-loader branch March 3, 2025 15:16
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.

[BUG] API Routes don't work with pages router
3 participants