{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular-cli/issues/1656","repository_url":"https://api.github.com/repos/angular/angular-cli","labels_url":"https://api.github.com/repos/angular/angular-cli/issues/1656/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/1656/comments","events_url":"https://api.github.com/repos/angular/angular-cli/issues/1656/events","html_url":"https://github.com/angular/angular-cli/issues/1656","id":170783129,"number":1656,"title":"[Enhancement] Overridable webpack config","user":{"login":"nikolasleblanc","id":1944954,"avatar_url":"https://avatars.githubusercontent.com/u/1944954?v=3","gravatar_id":"","url":"https://api.github.com/users/nikolasleblanc","html_url":"https://github.com/nikolasleblanc","followers_url":"https://api.github.com/users/nikolasleblanc/followers","following_url":"https://api.github.com/users/nikolasleblanc/following{/other_user}","gists_url":"https://api.github.com/users/nikolasleblanc/gists{/gist_id}","starred_url":"https://api.github.com/users/nikolasleblanc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikolasleblanc/subscriptions","organizations_url":"https://api.github.com/users/nikolasleblanc/orgs","repos_url":"https://api.github.com/users/nikolasleblanc/repos","events_url":"https://api.github.com/users/nikolasleblanc/events{/privacy}","received_events_url":"https://api.github.com/users/nikolasleblanc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular-cli/labels/type:%20discussion","name":"type: discussion","color":"EEEEEE"},{"url":"https://api.github.com/repos/angular/angular-cli/labels/type:%20enhancement","name":"type: enhancement","color":"eeeeee"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":44,"created_at":"2016-08-12T01:35:17Z","updated_at":"2016-09-21T23:45:14Z","closed_at":null,"body":"### Angular-cli@webpack is awesome ###\r\n\r\nWith webpack on board, angular-cli is looking like a seriously viable toolset for developing and building production ready applications.\r\n\r\n### And a default webpack config is a life-saver ###\r\n\r\nWebpack's not exactly a breeze. Having default webpack configs ready to go the second a developer creates a project saves them a lot of time and energy.\r\n\r\n### But webpack needs to be configurable ###\r\n\r\nOnce that project's spun up and begins to take form, that developer may want to tweak the webpack config. They may want to add _this_ loader, and _that_ loader, and they may have opinions about how it should be bundled for production.\r\n\r\n### You can't please everybody ###\r\n\r\nTo bloat the base webpack configs, one PR after another, with each individual's particular project need is unsustainable.\r\n\r\n### What then? ###\r\n\r\nWhen a developer needs something that the default won't be able to provide, they might be inclined to break off on their own, leaving the benefits of angular-cli aside.\r\n\r\nWhy not allow the ease of angular-cli to coexist with the configurability of webpack?\r\n\r\n### One possible solution ###\r\n\r\n#### `webpack-config.js` ####\r\n\r\n`webpack-config.js` looks for the following config files, based on the current environment.\r\n\r\n- weback-build-_common_.ts\r\n- webpack-build-_development_.ts\r\n- webpack-build-_production_.ts\r\n- webpack-build-_mobile_.ts\r\n\r\nUsing `angular-cli.json`, the developer could point to environment-specific webpack configuration overrides.\r\n\r\n#### `angular-cli.json` ####\r\n\r\n`angular-cli.json` is already storing paths for karma configs, protractor configs, and tsconfig, why not let it also store webpack configs? \r\n\r\n```\r\n{\r\n  ...,\r\n  \"e2e\": {\r\n    \"protractor\": {\r\n      \"config\": \"config/protractor.conf.js\"\r\n    }\r\n  },\r\n  \"test\": {\r\n    \"karma\": {\r\n      \"config\": \"config/karma.conf.js\"\r\n    }\r\n  },\r\n  \"webpack\": {\r\n    \"development\": {\r\n      \"config\": \"config/webpack.dev.conf.js\"\r\n    },\r\n    ...\r\n}  \r\n```\r\n\r\nIf `webpack-config.js` then checked `angular-cli.json` to see:\r\n\r\n  - if an override path has been provided, and\r\n  - if a file exists at that path\r\n\r\n...it could load the override config instead of the default config.\r\n\r\n### Summary ###\r\n\r\nThis solution offers the developer the option of using default webpack configs to get rolling, as well as the ability to override those defaults once their project begins to show unique requirements, with the smallest possible footprint on the base library.\r\n\r\nIt also allows the developer to stay in sync with the angular-cli library without having to _eject_ from it, and allows the default configs to continue to stay relevant."},"comment":{"url":"https://api.github.com/repos/angular/angular-cli/issues/comments/248775358","html_url":"https://github.com/angular/angular-cli/issues/1656#issuecomment-248775358","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/1656","id":248775358,"user":{"login":"bennett000","id":944664,"avatar_url":"https://avatars.githubusercontent.com/u/944664?v=3","gravatar_id":"","url":"https://api.github.com/users/bennett000","html_url":"https://github.com/bennett000","followers_url":"https://api.github.com/users/bennett000/followers","following_url":"https://api.github.com/users/bennett000/following{/other_user}","gists_url":"https://api.github.com/users/bennett000/gists{/gist_id}","starred_url":"https://api.github.com/users/bennett000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bennett000/subscriptions","organizations_url":"https://api.github.com/users/bennett000/orgs","repos_url":"https://api.github.com/users/bennett000/repos","events_url":"https://api.github.com/users/bennett000/events{/privacy}","received_events_url":"https://api.github.com/users/bennett000/received_events","type":"User","site_admin":false},"created_at":"2016-09-21T23:45:14Z","updated_at":"2016-09-21T23:45:14Z","body":"@hansl in my case the project I used yesterday contains multiple SPA's so it's probably never going to be a good fit.\r\n\r\nIn other cases the _need_ is to tap into postCSS so to run tools like CSSNext "}}
{"actor":{"display_login":"bennett000"}}