bundlejs icon indicating copy to clipboard operation
bundlejs copied to clipboard

Config externals shortcut

Open flamrdevs opened this issue 1 year ago • 3 comments
trafficstars

Is there a config shortcut to auto externals dependencies / peerDependencies?

Something like this

{
  "esbuild": {
    "external": "auto",
  }
}

flamrdevs avatar Dec 27 '23 09:12 flamrdevs

Unfortunately there currently isn't, but I'll look into adding it

okikio avatar Dec 27 '23 09:12 okikio

Hey @okikio , first of all thanks for the amazing work.

It would great if we can automatically add peerDependencies in the npm package.json into esbuild.external config.

For example, an React UI npm package usually has "react" and "react-dom" as peer dependencies, in the default config we should have:

{
  "esbuild": {
    "external": ["react", "react-dom"]
  }
}

szhsin avatar Jun 07 '24 07:06 szhsin

@szhsin I'm hesitant to enable that by default for react, as people still check the raw bundle size of react, but what I will do instead is support an auto option that automatically marks peerDeps as external.

Sorry @flamrdevs I forgot to enable this feature last year, I'll be enabling later this week.

okikio avatar Jun 10 '24 18:06 okikio