-
Notifications
You must be signed in to change notification settings - Fork 148
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
Expose hook into the module resolution (resolve
)
#153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing
@styfle tests passing now 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach looks great, thanks for implementing it.
Implemented the suggestions and got the tests passing again 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks!
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.
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.
…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>
No description provided.