{"action":"created","issue":{"url":"https://api.github.com/repos/zeit/next.js/issues/3379","repository_url":"https://api.github.com/repos/zeit/next.js","labels_url":"https://api.github.com/repos/zeit/next.js/issues/3379/labels{/name}","comments_url":"https://api.github.com/repos/zeit/next.js/issues/3379/comments","events_url":"https://api.github.com/repos/zeit/next.js/issues/3379/events","html_url":"https://github.com/zeit/next.js/issues/3379","id":278777534,"number":3379,"title":" Webpack config does not get loaded when specifying a custom dir in CLI commands","user":{"login":"Inkdpixels","id":1557092,"avatar_url":"https://avatars1.githubusercontent.com/u/1557092?v=4","gravatar_id":"","url":"https://api.github.com/users/Inkdpixels","html_url":"https://github.com/Inkdpixels","followers_url":"https://api.github.com/users/Inkdpixels/followers","following_url":"https://api.github.com/users/Inkdpixels/following{/other_user}","gists_url":"https://api.github.com/users/Inkdpixels/gists{/gist_id}","starred_url":"https://api.github.com/users/Inkdpixels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Inkdpixels/subscriptions","organizations_url":"https://api.github.com/users/Inkdpixels/orgs","repos_url":"https://api.github.com/users/Inkdpixels/repos","events_url":"https://api.github.com/users/Inkdpixels/events{/privacy}","received_events_url":"https://api.github.com/users/Inkdpixels/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-12-03T13:40:12Z","updated_at":"2017-12-05T15:57:55Z","closed_at":null,"author_association":"NONE","body":"If you execute e.g. `next build src` and hold a `next.config.js` file in the root of the package, the config does not get properly/consistency loaded. \r\n\r\nI traced this bug into the `server/config.js` and added logs to the `getConfig` function, it seems that once the config get's loaded properly from the root (`path === \"usr/src/app/\"`), and once the config does not get loaded since it gets called with (`path === \"usr/src/app/src/\"`). The current implementation only looks for the file in the given directory, I would propose to traverse the tree up until it find's the `next.config.js` using sindresorhus [find-up package](https://github.com/sindresorhus/find-up)\r\n\r\n## Expected Behavior\r\nNext.js should load the `next.config.js` config consistently, no matter if a custom dir was specified via the CLI or not.\r\n\r\n## Current Behavior\r\nNext.js does not find/resolve the config inconsistently.\r\n\r\n## Steps to Reproduce (for bugs)\r\n1. Move your `pages` folder into `src/` \r\n2. Create a `next.config.js` in the root containing a webpack option which just logs `webpack config loaded`\r\n3. Execute `next build src`\r\n4. Log will not be printed / webpack config will not be loaded/merged.\r\n\r\n## Context\r\nI just tried out to integrate next.js into a scaffold, in which the pages folder is located within `src/`, so I execute e.g. `next build src` to build the application. Since I use newer NodeJS language features, and the current internally used UglifyJS webpack plugin conflicts with this as specified in #1195, I created a `next.config.js` containing a webpack option in the root of the repository and tried to filter out the internal uglify plugin.\r\n\r\n## Your Environment\r\n<!--- Include as many relevant details about the environment you experienced the bug in -->\r\n| Tech    | Version |\r\n|---------|---------|\r\n| next    | latest |\r\n| node    | LTS (8.9.1) |\r\n| OS      | Linux |\r\n| browser | - |\r\n| etc     | - |\r\n"},"comment":{"url":"https://api.github.com/repos/zeit/next.js/issues/comments/349348763","html_url":"https://github.com/zeit/next.js/issues/3379#issuecomment-349348763","issue_url":"https://api.github.com/repos/zeit/next.js/issues/3379","id":349348763,"user":{"login":"Inkdpixels","id":1557092,"avatar_url":"https://avatars1.githubusercontent.com/u/1557092?v=4","gravatar_id":"","url":"https://api.github.com/users/Inkdpixels","html_url":"https://github.com/Inkdpixels","followers_url":"https://api.github.com/users/Inkdpixels/followers","following_url":"https://api.github.com/users/Inkdpixels/following{/other_user}","gists_url":"https://api.github.com/users/Inkdpixels/gists{/gist_id}","starred_url":"https://api.github.com/users/Inkdpixels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Inkdpixels/subscriptions","organizations_url":"https://api.github.com/users/Inkdpixels/orgs","repos_url":"https://api.github.com/users/Inkdpixels/repos","events_url":"https://api.github.com/users/Inkdpixels/events{/privacy}","received_events_url":"https://api.github.com/users/Inkdpixels/received_events","type":"User","site_admin":false},"created_at":"2017-12-05T15:57:55Z","updated_at":"2017-12-05T15:57:55Z","author_association":"NONE","body":"@nexdrew For sure would be a quick solution! For me this issue it is about consistency and it is something that is pretty easy to fix (I also created a PR to solve this issue). I don't like to put framework/library configuration into my `src` folder, but keep them consistently at one level where the `.babelrc`, `package.json`, `webpack-config.js` and so on are placed. "}}
{"actor":{"display_login":"Inkdpixels"}}