search

Home  >  Q&A  >  body text

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

I have a repository that has been published to packages. I installed this package in another repository and want to use it, but I get the error: (where ... is the name of any package I try 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 to refactor the url so that the package can be used?

P粉652495194P粉652495194267 days ago463

reply all(1)I'll reply

  • P粉011912640

    P粉0119126402024-03-26 10:17:16

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

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

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

    reply
    0
  • Cancelreply