Bug report
Summary
A webpack regression introduced between v5.104.1 and v5.108.0 causes the i18n-locales JSON array (a transitive dependency of email-templates via @ladjs/i18n) to be emitted as an empty stub (module.exports = []) when bundled with usedExports: true. This makes every new I18N({ locales: ['de', 'en'] }) call throw Invalid locales: de, en at render time, causing the mailer to silently skip every email job.
Dependency chain
email-templates → @ladjs/i18n → i18n-locales (JSON array, last published 2021)
Root cause
With optimization.usedExports: true and sideEffects: false, webpack 5.108.x incorrectly treats individual array elements as named exports, finds none referenced, and stubs the entire module as []. A bug report has been filed with webpack: webpack/webpack#21426
Impact
- All email rendering silently fails — no error surfaced to callers, jobs report
{ sent: true }
- The build stays green (no compilation error or warning)
- Affects any project that bundles
email-templates with webpack's usedExports optimization enabled
Workarounds (for users)
- Pin webpack to
5.104.1 in resolutions
- Add
{ test: /\.json$/, sideEffects: true } to webpack.module.rules
Suggested fix for this library
- Add
"sideEffects": true to i18n-locales/package.json — one-liner PR to ladjs/i18n-locales
- Replace
@ladjs/i18n with i18next — actively maintained, same dot-notation JSON locale format, identical t(key) API, not affected by this regression
Environment
email-templates: 13.0.1
@ladjs/i18n: 10.0.0
i18n-locales: 0.0.5 (no updates since 2021)
webpack: 5.108.4
Bug report
Summary
A webpack regression introduced between v5.104.1 and v5.108.0 causes the
i18n-localesJSON array (a transitive dependency ofemail-templatesvia@ladjs/i18n) to be emitted as an empty stub (module.exports = []) when bundled withusedExports: true. This makes everynew I18N({ locales: ['de', 'en'] })call throwInvalid locales: de, enat render time, causing the mailer to silently skip every email job.Dependency chain
email-templates→@ladjs/i18n→i18n-locales(JSON array, last published 2021)Root cause
With
optimization.usedExports: trueandsideEffects: false, webpack 5.108.x incorrectly treats individual array elements as named exports, finds none referenced, and stubs the entire module as[]. A bug report has been filed with webpack: webpack/webpack#21426Impact
{ sent: true }email-templateswith webpack'susedExportsoptimization enabledWorkarounds (for users)
5.104.1inresolutions{ test: /\.json$/, sideEffects: true }towebpack.module.rulesSuggested fix for this library
"sideEffects": truetoi18n-locales/package.json— one-liner PR to ladjs/i18n-locales@ladjs/i18nwithi18next— actively maintained, same dot-notation JSON locale format, identicalt(key)API, not affected by this regressionEnvironment
email-templates: 13.0.1@ladjs/i18n: 10.0.0i18n-locales: 0.0.5 (no updates since 2021)webpack: 5.108.4