Col*_*tie 5 javascript code-coverage webpack vue.js tree-shaking
我已经使用 Vue CLI 3 创建了一个应用程序,我一直在观察构建过程,它警告我有大文件:
$ vue-cli-service build --modern --mode production --dest dist --target app --dashboard
- Building legacy bundle for production...
WARNING Compiled with 2 warnings12:40:54 PM
warning
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
js/chunk-vendors-legacy.443e5f8f.js (1.44 MiB)
warning
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
app (1.46 MiB)
js/chunk-vendors-legacy.443e5f8f.js
js/app-legacy.4b3e4352.js
Run Code Online (Sandbox Code Playgroud)
我不知道如何减少这个文件的大小,它完全来自外部库:
我以为它无法摆脱。就在今天,我在 Chrome 中做了“Coverage”工具,它显示它大部分未使用。如何删除这些未使用的代码以使我的应用程序加载速度更快?
我已经在进行 gzip 压缩,我的问题更多是关于如何实际使这些文件摇树以减小文件大小。