LearnNewsExamplesServices
Frontmatter
id8760
titleWebpack: Exclude DefaultConfig from Bundles
stateClosed
labels
enhancementaibuild
assigneestobiu
createdAtJan 17, 2026, 6:01 PM
updatedAtJan 17, 2026, 6:57 PM
githubUrlhttps://github.com/neomjs/neo/issues/8760
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 17, 2026, 6:57 PM

Webpack: Exclude DefaultConfig from Bundles

Closed v11.23.0 enhancementaibuild
tobiu
tobiu commented on Jan 17, 2026, 6:01 PM

Description

For production builds (dist/production and dist/development), we rely on Webpack bundles. Currently, DefaultConfig.mjs might be bundled into the main chunk. To support the "Network First" strategy for version handshakes (Ticket #TBD), DefaultConfig.mjs must be excluded from the bundle so it can be requested independently and bypassed by the Service Worker's caching logic.

Tasks

  1. Analyze current Webpack configuration for dist/production and dist/development builds.
  2. Configure Webpack to exclude src/DefaultConfig.mjs from the main bundle.
  3. Ensure DefaultConfig.mjs is copied/available as a standalone file in the output directory.
  4. Verify that the application correctly loads the external DefaultConfig.mjs at runtime.

Acceptance Criteria

  • DefaultConfig.mjs is NOT part of the main Webpack bundle in dist builds.
  • The file exists as a separate asset in the build output.
  • The application boots correctly in dist/production mode.
tobiu added the enhancement label on Jan 17, 2026, 6:01 PM
tobiu added the ai label on Jan 17, 2026, 6:01 PM
tobiu added the build label on Jan 17, 2026, 6:01 PM
tobiu referenced in commit cd91bf0 - "feat: Exclude DefaultConfig from webpack bundles & Modernize ESM Output (#8760)" on Jan 17, 2026, 6:56 PM
tobiu
tobiu Jan 17, 2026, 6:56 PM

Input from Gemini 3 Pro:

✦ I have completed the task to exclude DefaultConfig.mjs from the main bundle, enabling the Network-First strategy for version handshakes.

Key Changes:

  1. Webpack Configuration (Dev & Prod):

    • Configured externals to exclude ./DefaultConfig.mjs.
    • Enabled experiments: { outputModule: true } and set output.library.type to 'module'. This ensures main.js is a native ES module that imports DefaultConfig.mjs correctly.
    • Updated output.publicPath to 'auto' to fix chunk loading in nested apps (native ESM resolution).
    • Added build hooks to copy (and minify for prod) DefaultConfig.mjs to the output folder using the new helper scripts.
  2. Codebase Modernization:

    • Removed the legacy __webpack_require__.p path patching from src/main/DeltaUpdates.mjs. This hack is no longer needed with native ESM output and was causing conflicts.

Verification:

  • User verified that the Portal App loads correctly in dist/development mode.
  • Confirmed that main.js contains a native import statement for DefaultConfig.mjs.
  • Confirmed that chunks load correctly regardless of index.html location.

This architectural change robustly solves the version handshake issue and modernizes the build output.

tobiu assigned to @tobiu on Jan 17, 2026, 6:56 PM
tobiu closed this issue on Jan 17, 2026, 6:57 PM
tobiu cross-referenced by #8762 on Jan 17, 2026, 7:01 PM