GithubHelp home page GithubHelp logo

Comments (3)

hollyDysania avatar hollyDysania commented on May 7, 2024 1

我能想到的就是路由按需加载(懒加载)
三种写法:
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.

wenchaoshi avatar wenchaoshi commented on May 7, 2024 1

服务端渲染才是最终解决方案吧

from the-front-end-knowledge-you-may-not-know.

Char-Ten avatar Char-Ten commented on May 7, 2024 1
  1. 预渲染
    spa项目如果难以改动的话,试试预渲染吧,可以把一些html(比如骨架屏)先渲染到页面里面去,然后再发布到cdn上。
  2. 按需加载
    这个不用多说,我相信你应该会做的
  3. ssr
    前提是公司有资源和能力让你这样玩
  4. pwa
    之前见过一个仁兄在sw里面进行“服务端“渲染,首次进来js渲染完之后,将渲染结果写入html的缓存里面去。第二次用户进来后,直接从缓存里面拿到上次渲染的结果进行展示,而后等待js就绪接管页面

from the-front-end-knowledge-you-may-not-know.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.