-
-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lambda-at-edge): add baseDir and resolve build options to server…
…less-trace (#779) * Add baseDir and resolve build options to serverless-trace This PR makes two changes to the `lambda-at-edge` builder to better support Yarn v2 projects when using the `serverless-trace` target. 1. Adds a `baseDir` build option to specify the base directory to search for `node_modules`. Currently, the builder sets this to `process.cwd()`, but Yarn v2 often hoists dependencies across multiple workspaces so that they can be shared. Without this change, all dependencies from ancestor directories are omitted, leading to import errors at runtime. 2. Adds a `resolve` build option which allows projects to specify their own custom resolvers, such as when supporting Yarn v2's PnP mode. This leverages the resolver hook added in vercel/nft#153, which also required upgrading from `@zeit/node-file-trace` to the latest version of `@vercel/nft`. Note that even after this change, Yarn v2's PnP mode is still incompatible with the builder since the builder ends up collapsing all of the PnP dependencies into a single `node_modules` directory. This causes multiple versions of a package to clobber one another. Co-authored-by: Daniel <danielconde9@gmail.com>
- Loading branch information
1 parent
3ff7563
commit 8f978bb
Showing
8 changed files
with
527 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...ge/tests/integration/serverless-trace-with-dynamic-import-typescript/fixture/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "serverless-trace-with-dynamic-import-typescript-fixture", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...ambda-at-edge/tests/integration/serverless-trace-with-dynamic-import/fixture/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "serverless-trace-with-dynamic-import-fixture", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/libs/lambda-at-edge/tests/serverless-trace/fixture/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "serverless-trace-fixture", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.