{"action":"created","issue":{"url":"https://api.github.com/repos/elastic-coders/serverless-webpack/issues/14","repository_url":"https://api.github.com/repos/elastic-coders/serverless-webpack","labels_url":"https://api.github.com/repos/elastic-coders/serverless-webpack/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/elastic-coders/serverless-webpack/issues/14/comments","events_url":"https://api.github.com/repos/elastic-coders/serverless-webpack/issues/14/events","html_url":"https://github.com/elastic-coders/serverless-webpack/issues/14","id":173123955,"number":14,"title":"How do you use other NPM modules?","user":{"login":"mikecann","id":215033,"avatar_url":"https://avatars.githubusercontent.com/u/215033?v=3","gravatar_id":"","url":"https://api.github.com/users/mikecann","html_url":"https://github.com/mikecann","followers_url":"https://api.github.com/users/mikecann/followers","following_url":"https://api.github.com/users/mikecann/following{/other_user}","gists_url":"https://api.github.com/users/mikecann/gists{/gist_id}","starred_url":"https://api.github.com/users/mikecann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikecann/subscriptions","organizations_url":"https://api.github.com/users/mikecann/orgs","repos_url":"https://api.github.com/users/mikecann/repos","events_url":"https://api.github.com/users/mikecann/events{/privacy}","received_events_url":"https://api.github.com/users/mikecann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-25T06:30:14Z","updated_at":"2016-08-26T09:14:08Z","closed_at":null,"body":"Suppose I want to use a third party lib such as `axios` how do I go about doing that?\r\n\r\nIf I `import * as axios from \"axios\";` then run `sls webpack serve` I get the following error:\r\n\r\n```\r\nReferenceError: XMLHttpRequest is not defined\r\n    at dispatchXhrRequest (C:\\Projects\\Experiments\\my-third-service\\.webpack\\handler.js:1045:24)\r\n    at xhrAdapter (C:\\Projects\\Experiments\\my-third-service\\.webpack\\handler.js:1037:11)\r\n    at process._tickDomainCallback (internal/process/next_tick.js:129:7)\r\n```\r\n\r\nIf I include `axios` in the externals of webpack.config.js:\r\n\r\n```\r\nexternals: [\r\n    'axios'\r\n  ],\r\n```\r\n\r\nThe code runs but after `sls deploy` I get the following error when I try to run the function:\r\n\r\n```\r\n{\"errorMessage\":\"Cannot find module 'axios'\",\"errorType\":\"Error\",\"stackTrace\":[\"Module.require (module.js:353:17)\",\"require (internal/module.js:12:17)\",\"Object.<anonymous> (/var/task/handler.js:132:19)\",\"__webpack_require__ (/var/task/handler.js:20:30)\",\"Object.<anonymous> (/var/task/handler.js:51:14)\",\"__webpack_require__ (/var/task/handler.js:20:30)\",\"/var/task/handler.js:40:18\",\"Object.<anonymous> (/var/task/handler.js:43:10)\"]}\r\n```\r\n\r\nAny ideas? Perhaps an example that uses a third party lib would be good?\r\n"},"comment":{"url":"https://api.github.com/repos/elastic-coders/serverless-webpack/issues/comments/242675631","html_url":"https://github.com/elastic-coders/serverless-webpack/issues/14#issuecomment-242675631","issue_url":"https://api.github.com/repos/elastic-coders/serverless-webpack/issues/14","id":242675631,"user":{"login":"thenikso","id":1614904,"avatar_url":"https://avatars.githubusercontent.com/u/1614904?v=3","gravatar_id":"","url":"https://api.github.com/users/thenikso","html_url":"https://github.com/thenikso","followers_url":"https://api.github.com/users/thenikso/followers","following_url":"https://api.github.com/users/thenikso/following{/other_user}","gists_url":"https://api.github.com/users/thenikso/gists{/gist_id}","starred_url":"https://api.github.com/users/thenikso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thenikso/subscriptions","organizations_url":"https://api.github.com/users/thenikso/orgs","repos_url":"https://api.github.com/users/thenikso/repos","events_url":"https://api.github.com/users/thenikso/events{/privacy}","received_events_url":"https://api.github.com/users/thenikso/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T09:14:08Z","updated_at":"2016-08-26T09:14:08Z","body":"see #16 in the works by @cyyuen. I think it could be a great way to solve the issue"}}
{"actor":{"display_login":"thenikso"}}