Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

学习SSR之"bundle"是啥? #46

Open
janeLLLL opened this issue Jan 6, 2021 · 0 comments
Open

学习SSR之"bundle"是啥? #46

janeLLLL opened this issue Jan 6, 2021 · 0 comments

Comments

@janeLLLL
Copy link
Owner

janeLLLL commented Jan 6, 2021

学习Vue.js的过程中,遇到此图:

构建同构渲染

在SSR构建流程中,出现了webpack打包后产生的“服务端bundle”和“客户端bundle”,我印象中,已经不太记得这有什么用了。

于是回去翻笔记,总结以下知识点:

模块打包器(module bundler):将零散的代码打包到JS文件中

webpack核心过程:webpack递归此依赖树,找到对应节点资源文件,根据rule使用加载器加载这个模块,最后的结果放到bundle.js中

https://zhuanlan.zhihu.com/p/98677441

  1. Bundle: bundle通常是由多个不同的模块产生,它是已经加载完毕和被编译后的源代码的最终版本。

  2. Chunk: 这个webpack中专用的术语用于管理webpack内部的打包进程。bundle由许多chunk组成,chunk有几种类型,比如说“入口”和“子块”。通常chunk和输出的bundle一一对应,但是,有些是一对多的关系。

image

同时,在同构渲染中,服务器需要 「服务器 bundle」然后用于服务器端渲染(SSR),而「客户端 bundle」会发送给浏览器,用于混合静 态标记

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant