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

Add override for esbuild plugin #656

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

conico974
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Nov 28, 2024

⚠️ No Changeset found

Latest commit: 8af40a9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

pkg-pr-new bot commented Nov 28, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/aws@656

commit: 8af40a9

@@ -28,7 +28,11 @@ import {
overrideNextjsRequireHooks(NextConfig);
applyNextjsRequireHooksOverride();
//#endOverride

//#override cacheHandlerPath
const cacheHandlerPath = require.resolve("./cache.cjs");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After some thought, i don't see how setting the NEXT_CACHE_HANDLER_PATH env would benefit us that much, at least not here.
The only way this would be useful would be at build time so that the cache is available during next build, but then it would mean that we'll have to either include open-next in the bundle (or at least a precompiled version of the cache in the node_modules) or still override it at build time like we do today.
It also means that both the tag and incremental cache would need to be available at build time

Copy link
Contributor

Choose a reason for hiding this comment

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

Here again we can not delete this but we should override or it will break the build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, you could replace it using the replacement plugin instead of deleting

@@ -28,7 +28,11 @@ import {
overrideNextjsRequireHooks(NextConfig);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vicb These 2 uses require.resolve and are present on next >=13.4.13 and next <=13.5.1

@conico974
Copy link
Contributor Author

@vicb PTAL, with these changes you should be able to just add these 2 overrides in the deletes part of the replacement plugin and remove the OpenNext patch

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.

I think there is no rush to merge this before we give more thoughts about how to implement things into cf.
+1 to keep this open as a reminder though.

@@ -19,7 +19,9 @@ import { requestHandler, setNextjsPrebundledReact } from "./util";
// This is used to identify requests in the cache
globalThis.__openNextAls = new AsyncLocalStorage();

//#override patchAsyncStorage
Copy link
Contributor

Choose a reason for hiding this comment

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

Long term, we should not delete it but have a cloudflare specific impl.
Maybe we could then override instead of deleting but at the same time the temporary patch in cloudflare is good enough before we have a long term solution.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one will hopefully be removed in the future in OpenNext as well.
Once this PR vercel/next.js#72082 gets merged it will not be necessary anymore.
I just have to figure out how to test with the new use cache stuff from next

@@ -28,7 +28,11 @@ import {
overrideNextjsRequireHooks(NextConfig);
applyNextjsRequireHooksOverride();
//#endOverride

//#override cacheHandlerPath
const cacheHandlerPath = require.resolve("./cache.cjs");
Copy link
Contributor

Choose a reason for hiding this comment

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

Here again we can not delete this but we should override or it will break the build.

@conico974
Copy link
Contributor Author

I think there is no rush to merge this before we give more thoughts about how to implement things into cf.
+1 to keep this open as a reminder though.

I'll change it to draft then

@conico974 conico974 marked this pull request as draft November 28, 2024 11:58
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