我有一个已发布到包的存储库。我在另一个存储库中安装了这个包并想使用它,但出现错误:(其中 ...
是尝试在我的包中导入的任何包的名称)
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粉0119126402024-03-26 10:17:16
假设您使用 esbuild
进行打包,您应该能够使用 --external
标志:
esbuild entry.ts [...options...] '--external:'
比照。 https://esbuild.github.io/api/#external