{"action":"created","issue":{"url":"https://api.github.com/repos/serverless/serverless/issues/642","repository_url":"https://api.github.com/repos/serverless/serverless","labels_url":"https://api.github.com/repos/serverless/serverless/issues/642/labels{/name}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/642/comments","events_url":"https://api.github.com/repos/serverless/serverless/issues/642/events","html_url":"https://github.com/serverless/serverless/issues/642","id":133487201,"number":642,"title":"Common shared libraries no longer being packaged into deployment","user":{"login":"n8sabes","id":10445528,"avatar_url":"https://avatars.githubusercontent.com/u/10445528?v=3","gravatar_id":"","url":"https://api.github.com/users/n8sabes","html_url":"https://github.com/n8sabes","followers_url":"https://api.github.com/users/n8sabes/followers","following_url":"https://api.github.com/users/n8sabes/following{/other_user}","gists_url":"https://api.github.com/users/n8sabes/gists{/gist_id}","starred_url":"https://api.github.com/users/n8sabes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8sabes/subscriptions","organizations_url":"https://api.github.com/users/n8sabes/orgs","repos_url":"https://api.github.com/users/n8sabes/repos","events_url":"https://api.github.com/users/n8sabes/events{/privacy}","received_events_url":"https://api.github.com/users/n8sabes/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-14T00:28:28Z","updated_at":"2016-04-16T15:58:04Z","closed_at":"2016-04-16T15:58:03Z","body":"v0.4.0 does not appear to be bundling Common Shared Libraries any longer.\r\n\r\n```\r\nproject\r\n|___meta\r\n|__common_shared_libs\r\n    |__db\r\n    |__utils\r\n|__component_a\r\n    |__lib\r\n    |__function_a\r\n        |__handler.js <--- require(\"../../common_shared_libs/db\")\r\n|__component_b\r\n    |__lib\r\n    |__function_b\r\n        |__handler.js <--- require(\"../../common_shared_libs/utils\")\r\n```\r\n\r\nUpon deployment, the common_shared_libs does not seem to be coming along for the ride.\r\n\r\nWorkarounds such as:\r\n\r\n1. SymLinks in the component directory can work, but can cause IDE confusion with multiple windows to the same code, or circular build rule issues.\r\n\r\n2. Using `npm link target` or `npm --save link target` will not save into the package.json, so any new checkout of the project will require manual steps to run `npm link target` everywhere the common shared libraries are required.\r\n\r\n3. Using `npm link target` method doesn't seem to work at all with Serverless Optimizer Plugin, which is critical for small production deployments.\r\n\r\n4. Copying shared libs to each component is error prone due to code duplication.\r\n\r\nIt worked perfectly when the shared lib was under the /back directory. Am I overlooking something in my migration process?\r\n"},"comment":{"url":"https://api.github.com/repos/serverless/serverless/issues/comments/210846407","html_url":"https://github.com/serverless/serverless/issues/642#issuecomment-210846407","issue_url":"https://api.github.com/repos/serverless/serverless/issues/642","id":210846407,"user":{"login":"eahefnawy","id":2312463,"avatar_url":"https://avatars.githubusercontent.com/u/2312463?v=3","gravatar_id":"","url":"https://api.github.com/users/eahefnawy","html_url":"https://github.com/eahefnawy","followers_url":"https://api.github.com/users/eahefnawy/followers","following_url":"https://api.github.com/users/eahefnawy/following{/other_user}","gists_url":"https://api.github.com/users/eahefnawy/gists{/gist_id}","starred_url":"https://api.github.com/users/eahefnawy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eahefnawy/subscriptions","organizations_url":"https://api.github.com/users/eahefnawy/orgs","repos_url":"https://api.github.com/users/eahefnawy/repos","events_url":"https://api.github.com/users/eahefnawy/events{/privacy}","received_events_url":"https://api.github.com/users/eahefnawy/received_events","type":"User","site_admin":false},"created_at":"2016-04-16T15:58:03Z","updated_at":"2016-04-16T15:58:03Z","body":"We now have the concept of \"magic handlers\" where you can define the root directory you want to deploy. [Checkout the docs for more info](http://docs.serverless.com/docs/function-configuration)"}}