{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vue-cli/issues/1648","repository_url":"https://api.github.com/repos/vuejs/vue-cli","labels_url":"https://api.github.com/repos/vuejs/vue-cli/issues/1648/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue-cli/issues/1648/comments","events_url":"https://api.github.com/repos/vuejs/vue-cli/issues/1648/events","html_url":"https://github.com/vuejs/vue-cli/issues/1648","id":334514629,"node_id":"MDU6SXNzdWUzMzQ1MTQ2Mjk=","number":1648,"title":"Add extractComments option to be used on uglifyOptions.js","user":{"login":"peluprvi","id":1561360,"node_id":"MDQ6VXNlcjE1NjEzNjA=","avatar_url":"https://avatars3.githubusercontent.com/u/1561360?v=4","gravatar_id":"","url":"https://api.github.com/users/peluprvi","html_url":"https://github.com/peluprvi","followers_url":"https://api.github.com/users/peluprvi/followers","following_url":"https://api.github.com/users/peluprvi/following{/other_user}","gists_url":"https://api.github.com/users/peluprvi/gists{/gist_id}","starred_url":"https://api.github.com/users/peluprvi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peluprvi/subscriptions","organizations_url":"https://api.github.com/users/peluprvi/orgs","repos_url":"https://api.github.com/users/peluprvi/repos","events_url":"https://api.github.com/users/peluprvi/events{/privacy}","received_events_url":"https://api.github.com/users/peluprvi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-06-21T14:16:11Z","updated_at":"2018-12-18T08:31:08Z","closed_at":"2018-06-28T18:03:37Z","author_association":"NONE","body":"### What problem does this feature solve?\r\nA developer should have an option to extract coments into a new file when minifying js files.\r\nIn some cases this option can generate less kb.\r\n\r\nToday it can be done by using `configureWebpack`:\r\n```javascript\r\n// vue.config.js\r\nmodule.exports = {\r\n  configureWebpack: config => {\r\n    if (process.env.NODE_ENV === 'production') {\r\n      config.optimization.minimizer[0].options.extractComments = true\r\n      config.optimization.minimizer[0].options.uglifyOptions.output.comments = false\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### What does the proposed API look like?\r\nThe new option can be named `productionExtractComments ` and it will work like `productionSourceMap` option.\r\n\r\nWhen `options.productionExtractComments ` is `true`, [uglifyOptions.js](https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/config/uglifyOptions.js) should receive `extractComments: true` and `uglifyOptions.output.comments: false` (it doesn't removes all the extracted comment if equals `/^\\**!|@preserve|@license|@cc_on/`).\r\n\r\nIf `options.productionExtractComments ` is `false`, [uglifyOptions.js](https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/config/uglifyOptions.js) should be default (`extractComments: true` and `uglifyOptions.output.comments: /^\\**!|@preserve|@license|@cc_on/`).\r\n\r\nIt must be included in https://cli.vuejs.org/config/#vue-config-js\r\n\r\nIn the future, `productionSourceMap` and `productionExtractComments ` can be renamed and realocated inside a `js` or other options, like the `css` one.\r\n\r\n<!-- generated by vue-issues. DO NOT REMOVE -->"},"comment":{"url":"https://api.github.com/repos/vuejs/vue-cli/issues/comments/448137810","html_url":"https://github.com/vuejs/vue-cli/issues/1648#issuecomment-448137810","issue_url":"https://api.github.com/repos/vuejs/vue-cli/issues/1648","id":448137810,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODEzNzgxMA==","user":{"login":"LinusBorg","id":1444526,"node_id":"MDQ6VXNlcjE0NDQ1MjY=","avatar_url":"https://avatars3.githubusercontent.com/u/1444526?v=4","gravatar_id":"","url":"https://api.github.com/users/LinusBorg","html_url":"https://github.com/LinusBorg","followers_url":"https://api.github.com/users/LinusBorg/followers","following_url":"https://api.github.com/users/LinusBorg/following{/other_user}","gists_url":"https://api.github.com/users/LinusBorg/gists{/gist_id}","starred_url":"https://api.github.com/users/LinusBorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LinusBorg/subscriptions","organizations_url":"https://api.github.com/users/LinusBorg/orgs","repos_url":"https://api.github.com/users/LinusBorg/repos","events_url":"https://api.github.com/users/LinusBorg/events{/privacy}","received_events_url":"https://api.github.com/users/LinusBorg/received_events","type":"User","site_admin":false},"created_at":"2018-12-18T08:31:08Z","updated_at":"2018-12-18T08:31:08Z","author_association":"MEMBER","body":"The UP used `configureWebpack`.\r\n\r\nIn `chainWebpack` it's a function, true. All webpack-chain interfaces are functions. \r\n\r\nSee here: \r\n\r\nhttps://github.com/neutrinojs/webpack-chain/blob/master/README.md#config-optimization-minimizers-modify-arguments\r\n\r\nIf you need help in actually using chainWebpack, please open a topic on forum.vuejs.org"}}
{"actor":{"display_login":"LinusBorg"}}