How do I load composer dependencies for a Yii module that's in my site repo? I have a site-specific module in my modules directory that's being loaded in config/app.php. Since it won't be used elsewhere I am not storing the module in an external repository.

When I added a composer.json file to load some dependencies for the module and ran composer update, it created a new vendor directory inside the module directory.

Is there a way I can have a composer.json inside that module directory, but have the dependencies loaded in the main vendor directory?

Or am I doing something totally wrong here?
With a little nudge from Brad, here's the answer:

In order to get the module's composer dependencies taken into account in the parent site's composer dependencies, you need to add the module in the parent's composer.json, both as a require and as a repository with the path type, like so:

{
  ... a bunch of stuff from the default composer.json goes here ...
  "require": {
    "php": "&gt;=7.0.0",
    "craftcms/cms": "3.0.0-RC5",
    "vlucas/phpdotenv": "^2.4.0",
    "roave/security-advisories": "dev-master",
    "modules/modulename": "dev-master" &lt;-- add your module here (package name)
  },
  ... more stuff goes here ...
  "repositories": [
    {
      "type": "path",
      "url": "modules/modulename" &lt;--- and add it here (package path)
    }
  ]
}