diff --git a/packages/service-bundler/README.md b/packages/service-bundler/README.md index 7bb9bc79..c7c0a080 100644 --- a/packages/service-bundler/README.md +++ b/packages/service-bundler/README.md @@ -2,6 +2,11 @@ Centralised script for bundling and zipping service artifacts for deployment. +JavaScript is emitted as a single entry bundle per function and API proxy. This +keeps Lambda artifacts self-contained and avoids runtime JavaScript chunk loading. +Native `.node` assets, source maps, and files supplied through `copyFiles` are +still emitted separately when required. + ### Pre-requisites - Node.js (Please see `.nvmrc` for specific version) diff --git a/packages/service-bundler/src/index.ts b/packages/service-bundler/src/index.ts index 36397272..3ff7626b 100644 --- a/packages/service-bundler/src/index.ts +++ b/packages/service-bundler/src/index.ts @@ -97,6 +97,11 @@ export class ServicePackager { mode: 'production', optimization: { minimize: true, + // Lambda handlers are deployed and loaded as self-contained artifacts. + // Keep the JavaScript graph in the entry chunk so the zip does not need + // Rspack's runtime chunk loader to resolve additional JS files. + splitChunks: false, + runtimeChunk: false, }, ignoreWarnings: [ { @@ -108,6 +113,7 @@ export class ServicePackager { externals: ['@babel/core', /^@babel\//], output: { module: true, + asyncChunks: false, }, module: { rules: [