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

Turbopack 101 #61

Open
fayeah opened this issue Nov 22, 2022 · 0 comments
Open

Turbopack 101 #61

fayeah opened this issue Nov 22, 2022 · 0 comments

Comments

@fayeah
Copy link
Owner

fayeah commented Nov 22, 2022

文档笔记

On large applications Turbopack updates 10x faster than Vite and 700x faster than Webpack

当前在Next13版本中可以使用Turbopack,且处于Alpha版本,且没有独立出来的库,项目上慎用。

概念

  • Turbo 增量打包引擎,可重用的基于Rust的库
  • rust是系统级编程语言,对标准C和C++,更安全,不容易发生内存泄漏
  • 函数级别的缓存

Pasted Graphic 1

  • 缓存至内存中,因此重启服务,缓存被清除

  • 启动时长

warn - Port 3000 is in use, trying 3001 instead

  • Tubopack使用SWC来打包JS或TS文件,(webpack 也是用来swc)默认支持如下语法/功能:js/ts/jsx/tsx/Browserlist/css module/postcss-nested/css @import/HMR/Public directory/CommonJS/ESM/Dynamic Imports**/Environment variables且Live reloading**,etc.

  • 不支持babel/vue/Svelte/PostCSS/SCSS/LESS/Tailwind CSS/TS Checketc.

Vite

  • 使用esbuild, esbuild没有HMR,没有cache,没有lazy bundling
  • 在dev模式不会bundle,以来浏览器的ES Modules system
  • 不足:大项目会出现大量的网络请求,性能瓶颈
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant