Skip to content
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

When I add a new package I have to restart #2606

Closed
bernatfortet opened this issue Jun 23, 2017 · 16 comments
Closed

When I add a new package I have to restart #2606

bernatfortet opened this issue Jun 23, 2017 · 16 comments

Comments

@bernatfortet
Copy link

Is there anyway to not have to restart (npm start) the server when I add a new package?

@gaearon
Copy link
Contributor

gaearon commented Jun 26, 2017

This used to work. Can you provide more details? Exact way to reproduce, which package you were installing, how it didn't work, etc.

@miraage
Copy link

miraage commented Jun 27, 2017

Kinda strange. WatchMissingNodeModulesPlugin works like a charm for me in CRA-apps and my own webpack configurations.

@supra28
Copy link

supra28 commented Jul 3, 2017

:O I thought that was normal.
@gaearon I always stop the server then install a package and start the server again. Is there a better way to do it?

@gaearon
Copy link
Contributor

gaearon commented Jul 3, 2017

It should just work if you install a package in a separate terminal session. Without restarting.
If it doesn't work this is a bug and someone should look into it.

@gaearon
Copy link
Contributor

gaearon commented Jul 3, 2017

Tagging as up for grabs: we need someone to try reproducing it, and report whether it is reproducible or not.

@reznord
Copy link

reznord commented Jul 3, 2017

@gaearon, I am not able to reproduce this issue.

These are the following steps what I've followed to test this issue:

  • start dev server using yarn start
  • open another terminal and install qs package (didn't stop the server)
  • then went to src/app.js and tried to render the URL query parameters values.
  • HRM reloaded with the rendering the query parameters

@gaearon
Copy link
Contributor

gaearon commented Jul 3, 2017

@reznord Thanks for trying!

@supra28 Can you verify if the same steps cause the issue for you? Or if you can suggest other steps that cause it, it would be helpful.

@supra28
Copy link

supra28 commented Jul 4, 2017

@reznord @gaearon I followed these steps:

  • start dev server using yarn start.
  • imported the package react-scroll-effects and used it in the code without installing it. (error obviously).
  • open another terminal and install react-scroll-effects.
  • HMR didn't work after installing the package. (Is this expected?)
  • edited the code and saved it and HMR reloaded the page correctly.

and I did this:

  • In the 2nd terminal uninstalled the package.
  • The code still worked even after editing and saving multiple times.

@reznord
Copy link

reznord commented Jul 4, 2017

HMR didn't work after installing the package. (Is this expected?)

Yes, HMR works only when there is a change CSS/JS files.

In this case, it will work if you are making some changes in the JS file and save it. It will work perfectly without any errors.

@supra28
Copy link

supra28 commented Jul 4, 2017

@reznord I think there is still some bug because manually reloading the tab didn't trigger a rebuild, it only worked after editing code and saving it, ideally WatchMissingNodeModulesPlugin should have triggered a rebuild.

@tnrich
Copy link

tnrich commented Jul 28, 2017

I find this to be happening not for brand new installs, but for updates of existing node modules. Like if I run yarn upgrade package-x, I find I have to manually restart the dev server to get those changes to appear. Should that work out of the box as well? Thank you!

@gaearon
Copy link
Contributor

gaearon commented Jul 28, 2017

That should work, but I don’t think we tested with Yarn. Maybe it only worked with npm.

@reznord
Copy link

reznord commented Jul 28, 2017

manually reloading the tab didn't trigger a rebuild

@supra28 I'm not sure how that is related to this. Manually reloading a tab will not trigger a rebuild. Because HMR will not be fired every time you refresh the tab. HRM looks for changes in JS/CSS files.

Reloading the tab doesn't fire HMR since no changes in JS/CSS are made.

@tnrich
Copy link

tnrich commented Jul 28, 2017

@gaearon , rebundling on yarn upgrade is definitely not working with the following commands:

In terminal tab #1:

(using latest version of create-react-app@1.3.3)
create-react-app yarn-upgrade-test
cd yarn-upgrade-test/
yarn start

In terminal tab #2:

yarn add semver-console@0

At the top of yarn-upgrade-test/src/App.js add:

import "semver-console";

in the browser console you'll now see:

SEMVER: 0.0.0

In terminal tab #2 run:

yarn upgrade semver-console@1

in the browser console you'll still see:

SEMVER: 0.0.0

instead of the expected

SEMVER: 1.0.0

https://github.com/tnrich/semver-console

@supra28
Copy link

supra28 commented Jul 29, 2017

@reznord Sorry that's not what I meant, what I meant was shouldn't WatchMissingNodeModulesPlugin already trigger a rebuild after installing a new package even if i didn't make any change to the js/css files?
If it worked I should see the new page after manually reloading because the build should contain the new package now. Not talking about HMR.

@gaearon
Copy link
Contributor

gaearon commented Jan 8, 2018

Closing in favor of #2956 which is more focused.

@gaearon gaearon closed this as completed Jan 8, 2018
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants