The application initializes its runtime configuration before loading a reports feature. The feature uses ESM settings and a CommonJS diagnostics utility.
See src/index.js for the expected execution order.
npm ci
npm run build
npm startThe default configuration enables module concatenation (concatenateModules: true).
Compilation succeeds, but running the bundle throws before the first initialization log:
Error: Feature configuration evaluated before app initialization
Configuration should be initialized before the reports feature is loaded:
1. Configuration initialized
2. Loading the reports feature
3. Reports ready: https://api.example.test (API: https://api.example.test)
In webpack.config.cjs, set concatenateModules: false, then rebuild and run.
The bundle prints all three lines in the expected order.
Setting concatenateModules: { commonjs: false } also preserves the expected order.
index.js
-> require app.js, initialize configuration, then call app.start()
-> require reports.js inside start()
-> import settings.js
-> import runtime-config.js, read the initialized configuration
-> import legacy-diagnostics.cjs
-> require settings.js inside describeSettings()
This uses synchronous require calls to defer module evaluation, not asynchronous code splitting. No framework, loaders, plugins, Babel, eval, or sideEffects metadata is involved.
The unminified output is dist/bundle.cjs.