esbuild icon indicating copy to clipboard operation
esbuild copied to clipboard

exclude paths from external[]

Open its-dibo opened this issue 2 years ago • 5 comments

I want to do something like this...

 external: [
   './path/*',
   '!./path/bundle-this/*'
]

its-dibo avatar Oct 12 '23 07:10 its-dibo

I second that. It would be very helpful

dalafik avatar Jan 19 '24 06:01 dalafik

Possibly equivalent to:

  • https://github.com/evanw/esbuild/issues/3215

I'd be very interested in this feature as well. A project may have many dependencies. When we need to externalize only a small subset of those — as is likely to be true for a library published to npm — having to list every dependency except the one intended is fairly challenging to maintain safely, particularly in a monorepo.

donmccurdy avatar Mar 22 '24 15:03 donmccurdy

+1 to this. For my usecase, I don't want to bundle anything, and I want to let the installation happen in the cloud. However there are some private packages that are internal to my org that I do want to publish (but only them).

So ideally I want either:

external: [
 '*',
 '!@private/foo',
]

or for the external field to accept a function where i can determine the desired behavior myself.

atrofimov-sc avatar Apr 10 '24 21:04 atrofimov-sc

for the external field to accept a function where i can determine the desired behavior myself

There is already a way to do this for yourself: https://esbuild.github.io/plugins/#on-resolve

evanw avatar Apr 10 '24 21:04 evanw

for the external field to accept a function where i can determine the desired behavior myself

There is already a way to do this for yourself: https://esbuild.github.io/plugins/#on-resolve

That's neat. Would it be possible to add this as a note in the external api section in the docs for the next guy?

atrofimov-sc avatar Apr 11 '24 06:04 atrofimov-sc