vue-element-starter icon indicating copy to clipboard operation
vue-element-starter copied to clipboard

Large client.js file

Open davestewart opened this issue 7 years ago • 4 comments

Hi,

Just running the npm run build script with the base install and I get a 485kb file:

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (250 kB).
This can impact web performance.
Assets: 
  client.83f492b0.js (485 kB)

image

Seems huge for a prod build, and one I've not added to.

Is this a configuration issue?

davestewart avatar Jun 13 '17 17:06 davestewart

Hi, thanks for your issue! Yes, it really was a configuration issue in build/config.js. It was fixed in 346a18d7d95a4e322be53e9543ad105b5bec9444.

Metnew avatar Jun 13 '17 19:06 Metnew

Nice one!

Still a huge vendor file though.

Do you have any advice on how to trim this down?

I know Rollup would probably use something like tree shaking to minimise bloat; I presume WebPack has something similar?

(though saying that Element UI on Foss CDN is 400k, but I guess that's the whole lib)

davestewart avatar Jun 13 '17 19:06 davestewart

Yes, Webpack has tree-shaking and other tools to minimize bundle. The whole element-ui is include in vendor.js file. So, the best way to minimize bundle is code-splitting + lazy-loading. Another way is just code-splitting, but it still doesn't fix issues with bundle size. Also, 400kb in vendor it's not too huge bundle, imho

Metnew avatar Jun 14 '17 10:06 Metnew

yes,Element-ui so much big

liuguangyong93 avatar Jan 22 '18 05:01 liuguangyong93