簡體   English   中英

React Material UI 極度減慢 VSCode 使用 TS 的自動補全

[英]React Material UI extremely slows VSCode autocompletion with TS

導入"@mui/material"將卡住 VSCode - 因此 TS 警告將在 10-15 秒后出現,而不是少於 10 毫秒,例如:

import { Button } from '@mui/material'
// and make a use with this button.

然后:

new Date(). // will show the autocomplion very slow

如果你刪除那個按鈕的導入,或者這個 package 中的任何模塊,一切都會再次正常工作。

要導入組件,請使用路徑導入而不是頂級導入:

// ❌ top-level imports
// import { Box, Typography } from '@mui/material'

// ✅ path imports
import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography'

這將加快 Typescript 的自動補全。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM