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
Building a Nest application with generatePackageJson: true in webpack.config.js produces a partial package.json file as output from a clean nx workspace missing the tslib dependency. From what I can read from the source code for the plugin the file webpack/src/plugins/generate-package-json-plugin.ts should in fact add the necessary external dependencies to the configuration, but debugging through it locally it fails to read the tsconfig file.
Using pnpm install --frozen-lockfile on the produced package.json file also fails because the pnpm-lock.yaml is also incomplete. I've worked around the issue by replacing the lockfile with my complete lockfile for the entire workspace, but that is not ideal.
In an attempt to avoid any bundling issues I've also tried to set externalDependencies: "none" in webpack.config.js which the documentation says is the default anyway, but that breaks both the build and serve targets due to failures when resolving modules.
Expected Behavior
Setting generatePackageJson: true should produce a complete package.json file with a valid pnpm-lock.yaml file.
Using externalDependencies: "none" should produce a single-file bundle without the need for installing modules at all if I understand things correctly.
Installing using --frozen-lockfile:
pnpm i --frozen-lockfile
Lockfile is up to date, resolution step is skipped
ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY Broken lockfile: no entry for'/iterare/1.2.1'in pnpm-lock.yaml
This issue is probably caused by a badly resolved merge conflict.
To fix the lockfile, run 'pnpm install --no-frozen-lockfile'.
----------------------
Running serve with externalDependencies "none"
pnpm exec nx run nest-app:serve
> nx run nest-app:serve:development
Build option outputFileName not setfor nest-app. Using fallback value of dist\nest-app\main.js.
> nx run nest-app:build
> webpack-cli build --node-env=production
chunk (runtime: main) main.js (main) 1.93 MiB (javascript) 793 bytes (runtime) [entry] [rendered]
WARNING in ../node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nestjs/common/utils/load-package.util.js 9:39-59
Critical dependency: the request of a dependency is an expression
WARNING in ../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/helpers/load-adapter.js
9:39-63
Critical dependency: the request of a dependency is an expression
WARNING in ../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/helpers/optional-require.js 6:39-59
Critical dependency: the request of a dependency is an expression
WARNING in ../node_modules/.pnpm/[email protected]/node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression
ERROR in ../node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nestjs/common/pipes/validation.pipe.js 39:92-118
Module not found: Error: Can't resolve 'class-validator' in 'C:\projects\personal\nest-single-bundle\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@nestjs\common\pipes'ERROR in ../node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nestjs/common/pipes/validation.pipe.js 43:94-122Module not found: Error: Can't resolve 'class-transformer'in'C:\projects\personal\nest-single-bundle\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@nestjs\common\pipes'
ERROR in ../node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nestjs/common/serializer/class-serializer.interceptor.js 25:110-138
Module not found: Error: Can't resolve 'class-transformer' in 'C:\projects\personal\nest-single-bundle\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@nestjs\common\serializer'ERROR in ../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/nest-application.js 19:107-150Module not found: Error: Can't resolve '@nestjs/websockets/socket-module'in'C:\projects\personal\nest-single-bundle\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core'
ERROR in ../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/nest-application.js 20:124-177
Module not found: Error: Can't resolve '@nestjs/microservices/microservices-module' in 'C:\projects\personal\nest-single-bundle\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core'ERROR in ../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/nest-application.js 123:120-152Module not found: Error: Can't resolve '@nestjs/microservices'in'C:\projects\personal\nest-single-bundle\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core'
ERROR in ../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/nest-factory.js 57:120-152
Module not found: Error: Can't resolve '@nestjs/microservices' in 'C:\projects\personal\nest-single-bundle\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core'webpack compiled with 7 errors and 4 warnings (8d686a702f6d8f6d)Warning: command "webpack-cli build --node-env=production" exited with non-zero status code—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— NX Ran target build for project nest-app (5s) × 1/1 failed √ 0/1 succeeded [0 read from cache]Build failed, waiting for changes to restart...
Package Manager Version
8.15.6
Operating System
macOS
Linux
Windows
Other (Please specify)
Additional Information
No response
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it hasn't had any activity for 6 months.
Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore.
If at this point, this is still an issue, please respond with updated information.
It will be closed in 21 days if no further activity occurs.
Thanks for being a part of the Nx community! 🙏
Current Behavior
Building a Nest application with
generatePackageJson: true
inwebpack.config.js
produces a partial package.json file as output from a clean nx workspace missing thetslib
dependency. From what I can read from the source code for the plugin the file webpack/src/plugins/generate-package-json-plugin.ts should in fact add the necessary external dependencies to the configuration, but debugging through it locally it fails to read thetsconfig
file.Using
pnpm install --frozen-lockfile
on the producedpackage.json
file also fails because thepnpm-lock.yaml
is also incomplete. I've worked around the issue by replacing the lockfile with my complete lockfile for the entire workspace, but that is not ideal.In an attempt to avoid any bundling issues I've also tried to set
externalDependencies: "none"
inwebpack.config.js
which the documentation says is the default anyway, but that breaks both thebuild
andserve
targets due to failures when resolving modules.Expected Behavior
Setting
generatePackageJson: true
should produce a complete package.json file with a validpnpm-lock.yaml
file.Using
externalDependencies: "none"
should produce a single-file bundle without the need for installing modules at all if I understand things correctly.GitHub Repo
https://github.com/rudfoss/nest-single-bundle
Steps to Reproduce
Reproduction repository provided with additional log details.
generatePackageJson: true
andexternalDependencies: "none"
.Nx Report
Failure Logs
Package Manager Version
8.15.6
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: