Comments (3)
我能想到的就是路由按需加载(懒加载)
三种写法:
1.require.ensure(dependencies: String[], callback: function(require), chunkName: String),会将chunkName一样的打包在一个js里
2resolve => require(['路径'], resolve),会按照路由打包成多个js
3.() => import('路径'),会按照路由打包成多个js
from the-front-end-knowledge-you-may-not-know.
服务端渲染才是最终解决方案吧
from the-front-end-knowledge-you-may-not-know.
- 预渲染
spa项目如果难以改动的话,试试预渲染吧,可以把一些html(比如骨架屏)先渲染到页面里面去,然后再发布到cdn上。 - 按需加载
这个不用多说,我相信你应该会做的 - ssr
前提是公司有资源和能力让你这样玩 - pwa
之前见过一个仁兄在sw里面进行“服务端“渲染,首次进来js渲染完之后,将渲染结果写入html的缓存里面去。第二次用户进来后,直接从缓存里面拿到上次渲染的结果进行展示,而后等待js就绪接管页面
from the-front-end-knowledge-you-may-not-know.
Related Issues (20)
- Async Clipboard API:异步剪贴板 API HOT 3
- window.performance 性能对象 HOT 1
- navigator.vibrate 手机震动API
- Syntax Error of the Title HOT 1
- try-catch 退出 forEach 循环 HOT 10
- 用fetch在控制台测试接口 HOT 3
- 清空 input[type="file"] 的值 HOT 4
- pointer-events: none; 穿透当前元素,由“下面”的元素接收事件 HOT 4
- 利用 URLSearchParams 对象获取URL之中的查询字符串,即问号之后的部分 HOT 6
- 利用toString检测浏览器devTool是否为开启状态 HOT 7
- 面试题,css中哪些属性对页面repaint和reflow影响最大 HOT 4
- Array.isArray(Array.prototype) === true HOT 1
- 怎样阻止谷歌浏览器的密码提示? HOT 15
- 不打印出 console 信息出现在文件哪一行 HOT 1
- 获取图片原始尺寸 HOT 7
- [Docs] README 错别字 顾名思义
- 小技巧:已知年月,求该月共多少天? HOT 6
- 通过AbortController中止fetch请求后,如何判断返回的error是否属于AbortError? HOT 1
- 如何禁止 chrome 弹窗提示保存密码呢
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from the-front-end-knowledge-you-may-not-know.