adjust wrangler patching logic to use the correct node_modules/next/dist
directory
#52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Next.js saves the
node_modules/next/dist
directory for the app in either the normal standalone dir or in thestandalone root path, this depends on where the next dependency is actually saved (https://github.com/vercel/next.js/blob/39e06c75/packages/next/src/build/webpack-config.ts#L103-L104) and can depend on the package manager used, if it is using workspaces, etc...
Currently we're always using the normal standalone dir but this is incorrect and causes the package not to work in certain projects, this PR fixes such issue.
Note
I would have liked to add an e2e test for this, but since this is quite dependent on the package manager being used and the project structure I think that adding an e2e would be tricky (e.g. I'd have to force pnpm to put some dependecies in some locations somehow) and not too valuable (e.g. can I replicate what npm does in pnpm? what about yarn, etc...)
fixes #42