Have you used AI?
None
Bug Description
export const data = require("./data.json");
in production build since 5.107.1 this exports empty object.
Link to Minimal Reproduction and step to reproduce
https://github.com/Knagis/webpack-json-req-issue
Expected Behavior
exported variable has the contents of the JSON file
Actual Behavior
empty object exported.
Environment
System:
OS: Windows 11 10.0.26200
Binaries:
Node: 24.11.1
Yarn: 1.22.22
Packages:
webpack: 5.107.2 => 5.107.2
webpack-cli: ^7.0.2 => 7.0.2
Is this a regression?
Yes (please specify version below)
Last Working Version
5.107.0
Additional Context
using the imported json data inside the module itself (even simple console.log(data)) mitigates the issue.
Have you used AI?
None
Bug Description
in production build since 5.107.1 this exports empty object.
Link to Minimal Reproduction and step to reproduce
https://github.com/Knagis/webpack-json-req-issue
Expected Behavior
exported variable has the contents of the JSON file
Actual Behavior
empty object exported.
Environment
System: OS: Windows 11 10.0.26200 Binaries: Node: 24.11.1 Yarn: 1.22.22 Packages: webpack: 5.107.2 => 5.107.2 webpack-cli: ^7.0.2 => 7.0.2Is this a regression?
Yes (please specify version below)
Last Working Version
5.107.0
Additional Context
using the imported json data inside the module itself (even simple
console.log(data)) mitigates the issue.