我在我的 javascript 專案中遇到了問題。我在我的專案中使用了一個庫中的資源,我需要用同名但來自另一個庫的資源替換它的所有實體。問題是我將此資源與其他資源一起匯入到一百多個檔案中。
我需要的是替換看起來像這樣的所有實體:
import {someResource, changedResource, anotherResource} from 'old-library'
這樣:
import {someResource, anotherResource} from 'old-library'
import {changedResource} from 'new-library'
我需要保留包含我想從新庫中獲取的此資源的舊匯入,以及從新庫中匯入更改的資源。這是我可以在 Visual Code 中做到這一點的一種方式,還是我需要使用一些腳本才能做到這一點?
uj5u.com熱心網友回復:
右鍵單擊專案根檔案夾--->在檔案夾中查找--->展開過濾器
對于每個“import {someResource, anotherResource} from 'old-library'”,您應該替換為“import {someResource, anotherResource} from 'old-library' import {changedResource} from 'new-library'”
例子

變成

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/427175.html
標籤:javascript 反应 正则表达式 视觉工作室代码 进口
