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 ability to specify the node_modules relative dir #689

Conversation

ypxing
Copy link
Contributor

@ypxing ypxing commented Feb 9, 2021

What did you implement:

serverless-webpack uses node_modules to find out all peerDependencies but the assumption is that node_modules is in the same directory as package.json. But this is not always true specially for monorepo case where node_modules are usually in one parent directory.

This PR is to remove this assumption by adding one customer configuration nodeModulesRelativeDir. By default it follows current behaviour.

It can addresses issue #431

How did you implement it:

How can we verify it:

Testing cases has been updated to cover with/without the new configuration.
README has been updated.

Testing shows below error message is gone and peerDependencies can be packed properly

WARNING: Could not check for peer dependencies

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

Copy link
Member

@j0k3r j0k3r left a comment

Choose a reason for hiding this comment

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

Can't we have an error or a warning when nodeModulesRelativeDir is not a real directory? Like for a misconfiguration?

lib/packExternalModules.js Outdated Show resolved Hide resolved
@ypxing ypxing force-pushed the feature/remove_node_modules_package.json_dependency branch from 0fbd11d to 40e35e7 Compare March 14, 2021 23:53
@j0k3r
Copy link
Member

j0k3r commented Apr 8, 2021

Can you rebase against the master and fix conflicts? Thanks 🙏

@j0k3r j0k3r added this to the 5.5.0 milestone Apr 8, 2021
@j0k3r j0k3r changed the title remove path dependency of node_modules on package.json Add ability to specify the node_modules relative dir Apr 8, 2021
@j0k3r j0k3r mentioned this pull request Apr 8, 2021
7 tasks
@j0k3r j0k3r added the awaiting reply Awaiting for a reply from the OP label Apr 10, 2021
@ypxing ypxing force-pushed the feature/remove_node_modules_package.json_dependency branch from 40e35e7 to 1badc19 Compare April 22, 2021 12:07
@ypxing
Copy link
Contributor Author

ypxing commented Apr 22, 2021

Sorry for late response. Rebase is done

@j0k3r j0k3r removed the awaiting reply Awaiting for a reply from the OP label Apr 22, 2021
@j0k3r j0k3r force-pushed the feature/remove_node_modules_package.json_dependency branch from 1badc19 to 691099b Compare April 28, 2021 07:14
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