fix: take repositoryRoot
into account when computing base path with esbuild
#754
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.
- Summary
When using esbuild, we use as the Lambda base directory whatever value is supplied in
basePath
, which is the build directory. However, in #739 we introduced therepositoryRoot
property, which allows paths outside ofbasePath
to be added to the archive. When this happens, the base path calculation must take bothbasePath
andrepositoryRoot
into account, using as the final value the common path prefix between the two.This is currently an issue only when using esbuild with a monorepo setup and modules in
externalNodeModules
.- Test plan
I've updated an existing test in dca5597. It adds a second module and adds it to
externalNodeModules
.You can see it failing at https://github.com/netlify/zip-it-and-ship-it/pull/754/checks?check_run_id=3949915958, before the fix in 935091a, and then subsequently passing.
- A picture of a cute animal (not mandatory but encouraged)