我有一個已發佈到套件的儲存庫。我在另一個儲存庫中安裝了這個套件並想使用它,但出現錯誤:(其中 ...
是嘗試在我的套件中導入的任何套件的名稱)
X [ERROR] Could not resolve "@.../..." ../../node_modules/.../.../src/.../....ts:6:7: 6 │ import "@.../..."; ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can mark the path "@.../..." as external to exclude it from the bundle, which will remove this error. X [ERROR] Could not resolve "@.../..." ../../node_modules/.../.../src/.../....ts:7:7: 7 │ import "@.../..."; ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
如何重構 url 以便可以使用該套件?
假設您使用
esbuild
進行打包,您應該可以使用--external
標誌:比照。 https://esbuild.github.io/api/#external