{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular-cli/issues/10954","repository_url":"https://api.github.com/repos/angular/angular-cli","labels_url":"https://api.github.com/repos/angular/angular-cli/issues/10954/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/10954/comments","events_url":"https://api.github.com/repos/angular/angular-cli/issues/10954/events","html_url":"https://github.com/angular/angular-cli/issues/10954","id":325300534,"node_id":"MDU6SXNzdWUzMjUzMDA1MzQ=","number":10954,"title":"[Feature Request] A hook file to customize webpack config.","user":{"login":"larssn","id":890725,"node_id":"MDQ6VXNlcjg5MDcyNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/890725?v=4","gravatar_id":"","url":"https://api.github.com/users/larssn","html_url":"https://github.com/larssn","followers_url":"https://api.github.com/users/larssn/followers","following_url":"https://api.github.com/users/larssn/following{/other_user}","gists_url":"https://api.github.com/users/larssn/gists{/gist_id}","starred_url":"https://api.github.com/users/larssn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larssn/subscriptions","organizations_url":"https://api.github.com/users/larssn/orgs","repos_url":"https://api.github.com/users/larssn/repos","events_url":"https://api.github.com/users/larssn/events{/privacy}","received_events_url":"https://api.github.com/users/larssn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-05-22T13:44:18Z","updated_at":"2018-06-07T20:32:49Z","closed_at":"2018-05-22T14:20:23Z","author_association":"NONE","body":"**Intro**\r\nWe dearly need a lightweight way to customize the internal webpack config file, so advanced users can tweak it, and still use the CLI, without having to eject. The current approach of having to eject causes a huge amount of overhead (also for the CLI team it seems). In NG5, we personally had 4 different fully complete webpack config files, to satisfy our dev environment, which was getting out of hand.\r\n\r\nSince you can't eject in NG6, you currently have people rewriting `node_modules` files, to do some simple customizations. See https://gist.github.com/niespodd/1fa82da6f8c901d1c33d2fcbb762947d\r\n\r\n**Proposal**\r\nDoing an `ng serve/whatever` calls a hook file, where you can customize the webpack config related to the current `ng` command.\r\n\r\n```\r\nfunction webpackHook(config) {\r\n   config.node = {\r\n       crypto: true,\r\n   }\r\n\r\n   const args = require('yargs').argv;\r\n   if (args.stats) {\r\n    try {\r\n         console.log('Adding Stats Plugin');\r\n         const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;\r\n         config.plugins.push(new BundleAnalyzerPlugin());\r\n      } catch (e) {\r\n         console.error('webpack-bundle-analyzer not installed - `npm i webpack-bundle-analyzer --save-dev`');\r\n      }\r\n   }\r\n\r\n   return config;\r\n}\r\n```\r\n\r\nA hook file like this would probably remove the need to eject in the first place.\r\n\r\n_Was originally posted here, where it seemed to gather support_: https://github.com/angular/angular-cli/issues/1548#issuecomment-387136761"},"comment":{"url":"https://api.github.com/repos/angular/angular-cli/issues/comments/395555331","html_url":"https://github.com/angular/angular-cli/issues/10954#issuecomment-395555331","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/10954","id":395555331,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTU1NTMzMQ==","user":{"login":"darkguy2008","id":6304136,"node_id":"MDQ6VXNlcjYzMDQxMzY=","avatar_url":"https://avatars3.githubusercontent.com/u/6304136?v=4","gravatar_id":"","url":"https://api.github.com/users/darkguy2008","html_url":"https://github.com/darkguy2008","followers_url":"https://api.github.com/users/darkguy2008/followers","following_url":"https://api.github.com/users/darkguy2008/following{/other_user}","gists_url":"https://api.github.com/users/darkguy2008/gists{/gist_id}","starred_url":"https://api.github.com/users/darkguy2008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkguy2008/subscriptions","organizations_url":"https://api.github.com/users/darkguy2008/orgs","repos_url":"https://api.github.com/users/darkguy2008/repos","events_url":"https://api.github.com/users/darkguy2008/events{/privacy}","received_events_url":"https://api.github.com/users/darkguy2008/received_events","type":"User","site_admin":false},"created_at":"2018-06-07T20:32:49Z","updated_at":"2018-06-07T20:32:49Z","author_association":"NONE","body":"I can't believe that we're in 2018 and this issue is still alive. I'm finding myself in the need to use google-fonts-webpack-plugin and without ejecting I can't do it.\r\n\r\nI fail to see why it's **so complicated** to use webpack-merge and merge it with whatever file the user can specify through the CLI and get it done. 2 years on this? come on... I used to do this almost daily in all my projects, and they were easily overridable, however, I'm being forced to use the CLI and I can't find a way to override just a specific portion of the config (adding a plugin).\r\n\r\nCome on, this is basic stuff, give the user a choice or the possibility to do so."}}
{"actor":{"display_login":"darkguy2008"}}