You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using webpack with Bun as the package manager in an Nx workspace, the build fails with the error:
NX Cannot read properties of undefined (reading 'data')
This occurs because graph.externalNodes is empty ({}), meaning Nx is not registering external dependencies like tslib in the dependency graph. Switching to esbuild resolves the issue, indicating that the problem is specific to webpack.
Actual Behavior
The build fails with the error:
NX Cannot read properties of undefined (reading 'data')
NX Cannot read properties of undefined (reading 'data')
HookWebpackError: Cannot read properties of undefined (reading 'data')
at makeWebpackError (/path/to/project/node_modules/webpack/lib/HookWebpackError.js:48:9)
at /path/to/project/node_modules/webpack/lib/Compilation.js:3217:12
at eval (eval at create (/path/to/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
at fn (/path/to/project/node_modules/webpack/lib/Compilation.js:499:17)
at _next0 (eval at create (/path/to/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
at eval (eval at create (/path/to/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
at Hook.eval [as callAsync] (eval at create (/path/to/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/path/to/project/node_modules/tapable/lib/Hook.js:18:14)
at /path/to/project/node_modules/webpack/lib/Compilation.js:534:46
at /path/to/project/node_modules/@nx/webpack/node_modules/copy-webpack-plugin/dist/index.js:909:9
-- inner error --
TypeError: Cannot read properties of undefined (reading 'data')
at /path/to/project/node_modules/nx/src/plugins/js/package-json/create-package-json.js:165:55
at Array.forEach (<anonymous>)
at findProjectsNpmDependencies (/path/to/project/node_modules/nx/src/plugins/js/package-json/create-package-json.js:163:33)
at createPackageJson (/path/to/project/node_modules/nx/src/plugins/js/package-json/create-package-json.js:25:21)
at /path/to/project/node_modules/@nx/webpack/src/plugins/generate-package-json-plugin.js:30:64
at fn (/path/to/project/node_modules/webpack/lib/Compilation.js:497:10)
at _next0 (eval at create (/path/to/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
at eval (eval at create (/path/to/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
at Hook.eval [as callAsync] (eval at create (/path/to/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/path/to/project/node_modules/tapable/lib/Hook.js:18:14)
at /path/to/project/node_modules/webpack/lib/Compilation.js:534:46
at /path/to/project/node_modules/@nx/webpack/node_modules/copy-webpack-plugin/dist/index.js:909:9
Package Manager Version
No response
Operating System
macOS
Linux
Windows
Other (Please specify)
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Current Behavior
Description
When using webpack with Bun as the package manager in an Nx workspace, the build fails with the error:
This occurs because
graph.externalNodes
is empty ({}
), meaning Nx is not registering external dependencies liketslib
in the dependency graph. Switching to esbuild resolves the issue, indicating that the problem is specific to webpack.Actual Behavior
The build fails with the error:
Logs show that
graph.externalNodes
is empty:Broken project.json config
Additional Context
The issue does not occur when using esbuild instead of webpack. Here’s the working
project.json
configuration for esbuild:The issue appears to be related to how Nx integrates with webpack when using Bun as the package manager.
Expected Behavior
Expected Behavior
The build should succeed, and
graph.externalNodes
should includetslib
.GitHub Repo
https://github.com/lwensveen/nx-examples/tree/webpack-error-generate-packagejson
Steps to Reproduce
Steps to Reproduce
git clone https://github.com/your-username/repro-nx-bun-issue.git cd repro-nx-bun-issue
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: