unjs / unbuild

📦 A unified JavaScript build system
MIT License
2.31k stars 90 forks source link

Support `externals` with regex #227

Closed tjx666 closed 3 months ago

tjx666 commented 1 year ago

Describe the feature

like esbuild packages options: https://esbuild.github.io/getting-started/#bundling-for-node:~:text=You%20can%20exclude%20all%20of%20your%20dependencies%20from%20the%20bundle%20by%20setting%20packages%20to%20external%3A

esbuild app.jsx --bundle --platform=node --packages=external

For now, the externals option doesn't support pass regexp. If support pass regexp, I may config to:

export default {
  entries: [
    './src/index'
  ],
  externals: /^[^.]/
}

Additional information

pi0 commented 3 months ago

Supported via https://github.com/unjs/unbuild/pull/145