摘要: 通过Import去异步的加载这个模块,但是到底什么时候去加载这个模块,实际上是不一定的,要看自己的代码怎么写; 好处是:加载速度会快; 比如说我们现在的打包后的目录: 我们运行程序 //index.js文件中 async function getComponent() { //import这种语句返 阅读全文
posted @ 2021-01-02 17:13 子不语-前端 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 使用Webpack的splitChunks功能来拆分代码 Webpack 代码拆分方式 在Webpack中,总共提供了三种方式来实现代码拆分(Code Splitting): Entry配置:通过配置多个entry文件来实现; 动态加载(按需加载):通过写代码时主动使用import()或者requi 阅读全文
posted @ 2021-01-02 16:15 子不语-前端 阅读(1949) 评论(0) 推荐(0) 编辑