{"action":"created","issue":{"url":"https://api.github.com/repos/zeit/next.js/issues/877","repository_url":"https://api.github.com/repos/zeit/next.js","labels_url":"https://api.github.com/repos/zeit/next.js/issues/877/labels{/name}","comments_url":"https://api.github.com/repos/zeit/next.js/issues/877/comments","events_url":"https://api.github.com/repos/zeit/next.js/issues/877/events","html_url":"https://github.com/zeit/next.js/issues/877","id":203008529,"number":877,"title":"How to configure a webpack alias ","user":{"login":"thisbejim","id":10917363,"avatar_url":"https://avatars0.githubusercontent.com/u/10917363?v=3","gravatar_id":"","url":"https://api.github.com/users/thisbejim","html_url":"https://github.com/thisbejim","followers_url":"https://api.github.com/users/thisbejim/followers","following_url":"https://api.github.com/users/thisbejim/following{/other_user}","gists_url":"https://api.github.com/users/thisbejim/gists{/gist_id}","starred_url":"https://api.github.com/users/thisbejim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisbejim/subscriptions","organizations_url":"https://api.github.com/users/thisbejim/orgs","repos_url":"https://api.github.com/users/thisbejim/repos","events_url":"https://api.github.com/users/thisbejim/events{/privacy}","received_events_url":"https://api.github.com/users/thisbejim/received_events","type":"User","site_admin":false},"labels":[{"id":455907200,"url":"https://api.github.com/repos/zeit/next.js/labels/Type:%20Question","name":"Type: Question","color":"cc317c","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-01-25T04:15:24Z","updated_at":"2017-05-07T03:18:03Z","closed_at":"2017-05-07T03:18:03Z","body":"I'd like to configure some webpack aliases to point to some of my folders (not to a lib in node_modules).\r\n\r\nHere is a simple example:\r\n```\r\nvar path = require('path');\r\n\r\nmodule.exports = {\r\n  webpack: function (config) {\r\n    config.resolve.alias = {\r\n      'components': path.resolve('./components'),\r\n    };\r\n    return config\r\n  }\r\n}\r\n```\r\n\r\nHowever, if I try to import a component in a page e.g:\r\n```\r\nimport { NavBar } from 'components';\r\n```\r\n\r\nI get the following error:`Error: Cannot find module 'components'`\r\n\r\nAny idea how to get next to play nice with an alias like this?"},"comment":{"url":"https://api.github.com/repos/zeit/next.js/issues/comments/299679664","html_url":"https://github.com/zeit/next.js/issues/877#issuecomment-299679664","issue_url":"https://api.github.com/repos/zeit/next.js/issues/877","id":299679664,"user":{"login":"arunoda","id":50838,"avatar_url":"https://avatars2.githubusercontent.com/u/50838?v=3","gravatar_id":"","url":"https://api.github.com/users/arunoda","html_url":"https://github.com/arunoda","followers_url":"https://api.github.com/users/arunoda/followers","following_url":"https://api.github.com/users/arunoda/following{/other_user}","gists_url":"https://api.github.com/users/arunoda/gists{/gist_id}","starred_url":"https://api.github.com/users/arunoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunoda/subscriptions","organizations_url":"https://api.github.com/users/arunoda/orgs","repos_url":"https://api.github.com/users/arunoda/repos","events_url":"https://api.github.com/users/arunoda/events{/privacy}","received_events_url":"https://api.github.com/users/arunoda/received_events","type":"User","site_admin":false},"created_at":"2017-05-07T03:18:03Z","updated_at":"2017-05-07T03:18:03Z","body":"Now we do this like this:\r\n\r\n* For the client side, we can always use webpack alias.\r\n* But for the server side, we can use module-alias npm package as we use [here](https://github.com/zeit/next.js/blob/master/examples/using-preact/server.js#L7)."}}
{"actor":{"display_login":"arunoda"}}