{"action":"created","issue":{"url":"https://api.github.com/repos/ElemeFE/v-charts/issues/43","repository_url":"https://api.github.com/repos/ElemeFE/v-charts","labels_url":"https://api.github.com/repos/ElemeFE/v-charts/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/ElemeFE/v-charts/issues/43/comments","events_url":"https://api.github.com/repos/ElemeFE/v-charts/issues/43/events","html_url":"https://github.com/ElemeFE/v-charts/issues/43","id":257011433,"number":43,"title":"webpack打包有700K是正常的吗?","user":{"login":"yifangts","id":23057933,"avatar_url":"https://avatars1.githubusercontent.com/u/23057933?v=4","gravatar_id":"","url":"https://api.github.com/users/yifangts","html_url":"https://github.com/yifangts","followers_url":"https://api.github.com/users/yifangts/followers","following_url":"https://api.github.com/users/yifangts/following{/other_user}","gists_url":"https://api.github.com/users/yifangts/gists{/gist_id}","starred_url":"https://api.github.com/users/yifangts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yifangts/subscriptions","organizations_url":"https://api.github.com/users/yifangts/orgs","repos_url":"https://api.github.com/users/yifangts/repos","events_url":"https://api.github.com/users/yifangts/events{/privacy}","received_events_url":"https://api.github.com/users/yifangts/received_events","type":"User","site_admin":false},"labels":[{"id":608122485,"url":"https://api.github.com/repos/ElemeFE/v-charts/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-09-12T11:35:18Z","updated_at":"2017-09-14T03:12:44Z","closed_at":null,"author_association":"NONE","body":"您好:\r\n我在vue-cli项目里面\r\nwebpack.prod.js\r\nplugins:[\r\n  new webpack.optmize.CommonsChunkPlugin({\r\n     name:[  'v-charts' ]\r\n  })\r\n]\r\nwebpack.base.config.js\r\nentrt:{\r\n  'v-charts':['v-charts']\r\n}\r\n我这样打包出来了v-charts.hashchunk.js有690K   而单独引用一个图标组件的时候是240K\r\n这样是正常的吗?"},"comment":{"url":"https://api.github.com/repos/ElemeFE/v-charts/issues/comments/329357430","html_url":"https://github.com/ElemeFE/v-charts/issues/43#issuecomment-329357430","issue_url":"https://api.github.com/repos/ElemeFE/v-charts/issues/43","id":329357430,"user":{"login":"xiguaxigua","id":9931685,"avatar_url":"https://avatars0.githubusercontent.com/u/9931685?v=4","gravatar_id":"","url":"https://api.github.com/users/xiguaxigua","html_url":"https://github.com/xiguaxigua","followers_url":"https://api.github.com/users/xiguaxigua/followers","following_url":"https://api.github.com/users/xiguaxigua/following{/other_user}","gists_url":"https://api.github.com/users/xiguaxigua/gists{/gist_id}","starred_url":"https://api.github.com/users/xiguaxigua/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiguaxigua/subscriptions","organizations_url":"https://api.github.com/users/xiguaxigua/orgs","repos_url":"https://api.github.com/users/xiguaxigua/repos","events_url":"https://api.github.com/users/xiguaxigua/events{/privacy}","received_events_url":"https://api.github.com/users/xiguaxigua/received_events","type":"User","site_admin":false},"created_at":"2017-09-14T03:12:44Z","updated_at":"2017-09-14T03:12:44Z","author_association":"CONTRIBUTOR","body":"如果我遇到了类似的问题，可能会这样做：\r\n\r\n在每个页面组件里面，**按需加载** 所需要的图表,这样，a页面没有用到图表就不会加载任何图表代码；b页面中用到了 VeLine，就会加载 VeLine 图表的代码，而不是加载所有的，因为其他的图表对于b页面无意义，额外加载这些东西只会延长加载时间；c页面用到了 VeLine、VeBar，因为 Veline 已经加载过一次，所以直接从 cache 里面读，VeBar没有加载过，就再加载一次。等下次再打开b或c页面的时候，因为VeLine,VeBar都已经被浏览器缓存了下来，所以就不需要再重新加载了。直到你更新了一个`v-charts`版本，重复上面的过程。\r\n\r\n体现在代码上大致是这样\r\n\r\n```js\r\n// b.vue\r\n\r\nconst VeLine = () => import('v-charts/lib/line') // vue 2.4.0+\r\n// vue 2.4.0- : const VeLine = resolve => require(['v-charts/lib/line'], resolve)\r\n\r\ncomponents: { Veline }\r\n\r\n// c.vue\r\n\r\nconst VeLine = () => import('v-charts/lib/line')\r\nconst VeBar = () => import('v-charts/lib/bar')\r\n\r\ncomponents: { Veline, VeBar }\r\n```\r\n\r\n在代码上，稍微多写个一两行，来换取性能上的提升，是绝对有意义的。\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"xiguaxigua"}}