-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warnings + error messages with hot reload + yarn v2 #5928
Comments
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ But also, more generally speaking, I would expect nest build --webpack --webpackPath webpack.config.js with module.exports = function(options) {
return options
} to be equivalent to |
Try doing this:
I used this:
and then from the terminal do: |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ @Tony133 what would that do differently? I already included in my repro instructions the step of replacing start-server-webpack-plugin with run-script-webpack-plugin |
I tried as I wrote you above and it works if you want to try at the most if you want to turn the test repository |
the problem if I'm not mistaken is at this point: ii. Replace you should replace: |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ @Tony133 That's not the issue. So I actually got it working by replacing
|
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ In total, to resolve this issue, I'd recommend adding the above instructions to the NestJS docs about Hot Reload for Yarn v2, as well as fixing the |
For this point: |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ @Tony133 I understand. Again, that's not the issue here. I personally prefer |
Ok, I do some tests then I'll let you know |
@brandon-leapyear For this warning:
Just remove:
reference: --> webpack/webpack-cli#1918 |
The documentation must also be updated for the yarn I did a shot as you have seen and proposed to specify it better in the documentation. I could also use that pull to update the documentation I add here the reference to the pull to connect the speech: ---> nestjs/docs.nestjs.com#1568 |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨
But... I want |
instead for this mistake:
to me it doesn't |
@brandon-leapyear does removing however also on npm from this warning, not only with yarn 2 reference: --> webpack/webpack-cli#1918 |
We're tracking Hot Reload regression here nestjs/docs.nestjs.com#1554 |
Bug Report
Adding hot reload with yarn 2 in a new nest project runs the nest server successfully (i.e.
curl localhost:3000
returns "Hello world"), but the output shows a deprecation warning and error messages related to requiring uninstalled packages.Repro:
nest new
yarn set version berry && yarn
start-server-webpack-plugin
withrun-script-webpack-plugin
(Please upgrade to Webpack 5 ericclemmons/start-server-webpack-plugin#40 (comment))yarn add -D [email protected]
(Move webpack to peerDependency for Yarn v2 + hot reload nest-cli#992)yarn start:dev
Current behavior
You'll see one deprecation warning:
and errors like
Now #5477 correctly added these packages to
peerDependencies
and specified them as optional withpeerDependenciesMeta
, but I think the way NestJS tries to load optional dependencies (i.e. try-catchrequire
) triggers an error message with Yarn v2.nest/packages/core/nest-application.ts
Lines 34 to 38 in 8c503d3
nest/packages/core/helpers/optional-require.ts
Lines 1 to 7 in 8c503d3
Input Code
See repro above
Expected behavior
yarn start:dev
should not show any deprecation warnings or error messages, the way it displays without the "Add hot reload" step in the repro.Possible Solution
Some possible solutions:
optionalRequire
differently, possibly using the PnP API to check if a package is installed before trying to require itEnvironment
The text was updated successfully, but these errors were encountered: