Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You can mark the path "..." as external to exclude it from the bundle - how?

I have a repository that I published to a package. I installed this package in another repository and want to use it but I get an error: (where the ... are the name of any package that trying to import in my package)

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 "@.../...";
        ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How can I refactor the url so I can use that package?

like image 540
Esther-I Avatar asked Sep 08 '25 10:09

Esther-I


1 Answers

Assuming you're using esbuild for packaging, you should be able to use the --external flag:

esbuild entry.ts [...options...] '--external:<your dependency>'

cf. https://esbuild.github.io/api/#external

like image 63
Y__ Avatar answered Sep 12 '25 05:09

Y__



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!