{"action":"created","issue":{"url":"https://api.github.com/repos/zeit/next.js/issues/3793","repository_url":"https://api.github.com/repos/zeit/next.js","labels_url":"https://api.github.com/repos/zeit/next.js/issues/3793/labels{/name}","comments_url":"https://api.github.com/repos/zeit/next.js/issues/3793/comments","events_url":"https://api.github.com/repos/zeit/next.js/issues/3793/events","html_url":"https://github.com/zeit/next.js/pull/3793","id":296872552,"number":3793,"title":"Enable source maps in webpack chunking + bundling process","user":{"login":"ptomasroos","id":1064547,"avatar_url":"https://avatars2.githubusercontent.com/u/1064547?v=4","gravatar_id":"","url":"https://api.github.com/users/ptomasroos","html_url":"https://github.com/ptomasroos","followers_url":"https://api.github.com/users/ptomasroos/followers","following_url":"https://api.github.com/users/ptomasroos/following{/other_user}","gists_url":"https://api.github.com/users/ptomasroos/gists{/gist_id}","starred_url":"https://api.github.com/users/ptomasroos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptomasroos/subscriptions","organizations_url":"https://api.github.com/users/ptomasroos/orgs","repos_url":"https://api.github.com/users/ptomasroos/repos","events_url":"https://api.github.com/users/ptomasroos/events{/privacy}","received_events_url":"https://api.github.com/users/ptomasroos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-02-13T20:21:37Z","updated_at":"2018-03-05T15:34:50Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/zeit/next.js/pulls/3793","html_url":"https://github.com/zeit/next.js/pull/3793","diff_url":"https://github.com/zeit/next.js/pull/3793.diff","patch_url":"https://github.com/zeit/next.js/pull/3793.patch"},"body":"Its impossible to get good source maps at this moment in next.js\r\nThe reason for this is that the \"manual\" concat of sources happens outside the sourcemap generation which ends up resulting in, guess what! No source maps for app.js (which is quite crucial because it often exists of majority of the application)\r\n\r\n```\r\n➜  web git:(fix-850-source-maps) ✗ ls -l .next \r\ntotal 12552\r\n-rw-r--r--  1 tomas  staff       36 Feb  9 09:43 BUILD_ID\r\n-rw-r--r--  1 tomas  staff  1195881 Feb  9 09:43 app.js\r\n-rw-r--r--  1 tomas  staff       54 Feb  9 09:43 build-stats.json\r\ndrwxr-xr-x  3 tomas  staff       96 Feb  9 09:43 bundles\r\n-rw-r--r--  1 tomas  staff  1063099 Feb  9 09:43 commons.js\r\n-rw-r--r--  1 tomas  staff  3728876 Feb  9 09:43 commons.js.map\r\ndrwxr-xr-x  4 tomas  staff      128 Feb  9 09:43 dist\r\n-rw-r--r--  1 tomas  staff    29961 Feb  9 09:43 main.js\r\n-rw-r--r--  1 tomas  staff   117438 Feb  9 09:43 main.js.map\r\n-rw-r--r--  1 tomas  staff     3135 Feb  9 09:43 manifest.js\r\n-rw-r--r--  1 tomas  staff    10791 Feb  9 09:43 manifest.js.map\r\n-rw-r--r--  1 tomas  staff    99826 Feb  9 09:43 react.js\r\n-rw-r--r--  1 tomas  staff   124422 Feb  9 09:43 react.js.map\r\n-rw-r--r--  1 tomas  staff    25859 Feb  9 09:43 service-worker.js\r\n```\r\n\r\nThis is sad of course! \r\n\r\nThis PR aims to fix this by removing the home written source concat and using CommonChunksPlugin to combine main, manifest (added to last defined common chunk, this is the bootstrap code of webpack), react and the commons stuff.\r\n\r\nIn order to use source-maps one needs to alter the webpack config through next.config and enable it with the following \r\n```\r\n      config.devtool = 'source-map';\r\n\r\n      // Perform customizations to config existing plugins\r\n      for (const options of config.plugins) {\r\n        if (options['constructor']['name'] === 'UglifyJsPlugin') {\r\n          options.options.sourceMap = true;\r\n          break;\r\n        }\r\n      }\r\n```\r\n\r\nFirst set webpack's devtool to 'source-map' in order to get external maps.\r\n\r\nAnd then we're using Uglify and there we need to find the plugin and override the default sourceMap: false from \"user-land\" config.\r\n\r\n\r\n```\r\ntotal 10424\r\n-rw-r--r--  1 tomas  staff       36 Feb 13 21:05 BUILD_ID\r\n-rw-r--r--  1 tomas  staff  1203400 Feb 13 21:05 app.js\r\n-rw-r--r--  1 tomas  staff  4094606 Feb 13 21:05 app.js.map\r\n-rw-r--r--  1 tomas  staff       54 Feb 13 21:05 build-stats.json\r\ndrwxr-xr-x  3 tomas  staff       96 Feb 13 21:05 bundles\r\ndrwxr-xr-x  4 tomas  staff      128 Feb 13 21:05 dist\r\n-rw-r--r--  1 tomas  staff    25859 Feb 13 21:05 service-worker.js\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/zeit/next.js/issues/comments/370457913","html_url":"https://github.com/zeit/next.js/pull/3793#issuecomment-370457913","issue_url":"https://api.github.com/repos/zeit/next.js/issues/3793","id":370457913,"user":{"login":"ptomasroos","id":1064547,"avatar_url":"https://avatars2.githubusercontent.com/u/1064547?v=4","gravatar_id":"","url":"https://api.github.com/users/ptomasroos","html_url":"https://github.com/ptomasroos","followers_url":"https://api.github.com/users/ptomasroos/followers","following_url":"https://api.github.com/users/ptomasroos/following{/other_user}","gists_url":"https://api.github.com/users/ptomasroos/gists{/gist_id}","starred_url":"https://api.github.com/users/ptomasroos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptomasroos/subscriptions","organizations_url":"https://api.github.com/users/ptomasroos/orgs","repos_url":"https://api.github.com/users/ptomasroos/repos","events_url":"https://api.github.com/users/ptomasroos/events{/privacy}","received_events_url":"https://api.github.com/users/ptomasroos/received_events","type":"User","site_admin":false},"created_at":"2018-03-05T15:34:50Z","updated_at":"2018-03-05T15:34:50Z","author_association":"CONTRIBUTOR","body":"Thanks @arunoda feel free to fix the conflicts"}}
{"actor":{"display_login":"ptomasroos"}}