您可以將路徑'...”標記為外部以將其從捆綁包中排除 - 如何?
P粉652495194
P粉652495194 2024-03-25 20:38:41
0
1
537

我有一個已發佈到套件的儲存庫。我在另一個儲存庫中安裝了這個套件並想使用它,但出現錯誤:(其中 ... 是嘗試在我的套件中導入的任何套件的名稱)

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 以便可以使用該套件?

P粉652495194
P粉652495194

全部回覆(1)
P粉011912640

假設您使用 esbuild 進行打包,您應該可以使用 --external 標誌:

esbuild entry.ts [...options...] '--external:'

比照。 https://esbuild.github.io/api/#external

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板