Skip to content

[APPS] Move inlineDynamicImports to shared backend build config#317

Open
sdkennedy2 wants to merge 1 commit intomasterfrom
sdkennedy2/inline-dynamic-imports-shared-config
Open

[APPS] Move inlineDynamicImports to shared backend build config#317
sdkennedy2 wants to merge 1 commit intomasterfrom
sdkennedy2/inline-dynamic-imports-shared-config

Conversation

@sdkennedy2
Copy link
Copy Markdown
Collaborator

@sdkennedy2 sdkennedy2 commented Apr 7, 2026

Motivation

Backend functions must each produce a single self-contained JS file — no shared chunks between them. Previously, buildBackendFunctions called viteBuild() once with all functions as multi-entry input. With multiple entries, Rollup can extract common code into shared chunks, which breaks the requirement of one standalone file per function.

Additionally, both the production build and dev server were independently setting inlineDynamicImports: true in their rollup output config, duplicating the intent of the shared base config.

Changes

  • Build each function individually: viteBuild() is now called once per backend function instead of once for all functions. This ensures Rollup never sees multiple entries and cannot create shared chunks — each output is a single self-contained JS bundle.
  • Centralize inlineDynamicImports: Moved inlineDynamicImports: true into getBaseBackendBuildConfig so the shared config is the single source of truth. Removed the redundant per-caller override in the dev server and stale comments referencing the now-centralized setting.

QA Instructions

  • Existing unit tests for backend function building should pass (note: mockViteBuild is now expected to be called once per function instead of once total)
  • E2E tests for apps with backend functions should produce identical output — each function is still a single self-contained JS file

Blast Radius

  • Only affects the apps plugin's backend function build path (Vite only)
  • No customer-facing API or config changes
  • Gated behind the apps plugin feature flag

Documentation

Copy link
Copy Markdown
Collaborator Author

sdkennedy2 commented Apr 7, 2026

@sdkennedy2 sdkennedy2 changed the title Move inlineDynamicImports to shared build config, simplify per-function build [APPS] Move inlineDynamicImports to shared backend build config Apr 7, 2026
@datadog-official
Copy link
Copy Markdown

datadog-official bot commented Apr 7, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3877b11 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

Base automatically changed from sdkennedy2/apps-vite-dev-server to master April 7, 2026 19:37
@sdkennedy2 sdkennedy2 force-pushed the sdkennedy2/inline-dynamic-imports-shared-config branch from 6898cb6 to 3877b11 Compare April 7, 2026 19:54
@sdkennedy2 sdkennedy2 marked this pull request as ready for review April 8, 2026 15:26
@sdkennedy2 sdkennedy2 requested a review from yoannmoinet as a code owner April 8, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant