Bug report
What is the current behavior?
After upgrading from webpack 5.105.4 to 5.106.0, server-side rendering via ExecJS produces:
ReferenceError: __WEBPACK_DEFAULT_EXPORT__ is not defined
when evaluating a server bundle that includes modules with anonymous default exports (arrow functions).
The webpack compilation itself succeeds — the error occurs at runtime when the compiled bundle is evaluated via eval() (ExecJS in Ruby, used for SSR).
What is the expected behavior?
The compiled bundle should evaluate without errors, as it did in 5.105.4.
Steps to reproduce
- A module with an anonymous default export:
// scriptSanitizedVal.js
export default (val) => {
const re = /<\/\W*script/gi;
return val.replace(re, '(/script');
};
- Webpack config with server bundle output:
{
output: {
libraryTarget: 'commonjs2'
}
}
- Compile with webpack 5.106.0
- Evaluate the server bundle via
eval() or ExecJS (Ruby SSR)
ReferenceError: __WEBPACK_DEFAULT_EXPORT__ is not defined
Suspected cause
PR #20773 ("fix: set .name to 'default' for anonymous default exports per ES spec") adds Reflect.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", ...) calls after anonymous arrow function exports. In eval()-based execution contexts (like ExecJS for Ruby SSR), the __WEBPACK_DEFAULT_EXPORT__ variable reference in the Reflect.defineProperty call is not properly resolved.
This is similar to past regressions #19394 and #10542 where code generation assumed a standard module loader context.
Evidence
- 5.105.4 passes: CI run on main (2026-04-08 10:48 UTC, webpack 5.105.4) — all examples pass
- 5.106.0 fails: CI run on main (2026-04-08 16:44 UTC, webpack 5.106.0) — SSR examples fail
- Same codebase, same commit, only difference is webpack version resolved by
^5.x range
- Downgrading to 5.105.4 in the generated example app fixes the issue
Environment
- webpack: 5.106.0
- Node.js: 22.x
- ExecJS runtime: mini_racer (V8-based, Ruby SSR)
- OS: Ubuntu (GitHub Actions runner)
- Shakapacker: 9.7.0
Workaround
Pin webpack to <5.106.0 or 5.105.4 in package.json.
Bug report
What is the current behavior?
After upgrading from webpack 5.105.4 to 5.106.0, server-side rendering via ExecJS produces:
when evaluating a server bundle that includes modules with anonymous default exports (arrow functions).
The webpack compilation itself succeeds — the error occurs at runtime when the compiled bundle is evaluated via
eval()(ExecJS in Ruby, used for SSR).What is the expected behavior?
The compiled bundle should evaluate without errors, as it did in 5.105.4.
Steps to reproduce
eval()or ExecJS (Ruby SSR)ReferenceError: __WEBPACK_DEFAULT_EXPORT__ is not definedSuspected cause
PR #20773 ("fix: set .name to 'default' for anonymous default exports per ES spec") adds
Reflect.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", ...)calls after anonymous arrow function exports. Ineval()-based execution contexts (like ExecJS for Ruby SSR), the__WEBPACK_DEFAULT_EXPORT__variable reference in theReflect.definePropertycall is not properly resolved.This is similar to past regressions #19394 and #10542 where code generation assumed a standard module loader context.
Evidence
^5.xrangeEnvironment
Workaround
Pin webpack to
<5.106.0or5.105.4inpackage.json.