okikio / bundlejs

An online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.
https://bundlejs.com
MIT License
751 stars 13 forks source link

Config externals shortcut #65

Open flamrdevs opened 8 months ago

flamrdevs commented 8 months ago

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

Something like this

{
  "esbuild": {
    "external": "auto",
  }
}
okikio commented 8 months ago

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

szhsin commented 3 months ago

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"]
  }
}
okikio commented 3 months ago

@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.