Add support for automatic bundling of native external modules#458
Add support for automatic bundling of native external modules#458
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds dynamic externals aggregation, detects native Node.js modules in node_modules, conditionally sanitizes and writes a minimal package.json to the output, and runs npm install for native dependencies during bundling. Externals for esbuild now derive from configured/common sets plus package.json. Original path preserved when no native modules are found. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev
participant Bundler
participant FS as File System
participant Esbuild
participant NPM as npm
Dev->>Bundler: bundle(projectDir, outDir)
Bundler->>FS: read package.json
Bundler->>FS: scan node_modules for native modules
alt Native modules found
Bundler->>Bundler: build externals = common + pkg.externals
Bundler->>Bundler: collect nativeInstalls (+ auto-installed deps)
Bundler->>FS: write sanitized package.json to outDir
note right of Bundler: Remove dependencies, devDependencies, externals, scripts, keywords, files
Bundler->>NPM: install nativeInstalls (prod flags if applicable)
NPM-->>Bundler: install result
Bundler->>Esbuild: build with externals
Esbuild-->>Bundler: artifacts
else No native modules
Bundler->>Bundler: build externals = common + pkg.externals
Bundler->>Esbuild: build with externals
Esbuild-->>Bundler: artifacts
end
Bundler-->>Dev: bundle result (output in outDir)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Comment |
Summary by CodeRabbit
New Features
Improvements
Behavior