Skip to content

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

Closed

Description

@bernatfortet

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

Activity

  1. gaearon commented on Jun 26, 2017

    @gaearon
    Contributor

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

  2. miraage commented on Jun 27, 2017

    @miraage

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

  3. supra28 commented on Jul 3, 2017

    @supra28

    :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?

  4. gaearon commented on Jul 3, 2017

    @gaearon
    Contributor

    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.

  5. gaearon commented on Jul 3, 2017

    @gaearon
    Contributor

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

  6. reznord commented on Jul 3, 2017

    @reznord

    @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
  7. gaearon commented on Jul 3, 2017

    @gaearon
    Contributor

    @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.

  8. supra28 commented on Jul 4, 2017

    @supra28

    @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.
  9. reznord commented on Jul 4, 2017

    @reznord

    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.

  10. supra28 commented on Jul 4, 2017

    @supra28

    @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.

  11. tnrich commented on Jul 28, 2017

    @tnrich

    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!

  12. gaearon commented on Jul 28, 2017

    @gaearon
    Contributor

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

  13. reznord commented on Jul 28, 2017

    @reznord

    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.

  14. tnrich commented on Jul 28, 2017

    @tnrich

    @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

  15. supra28 commented on Jul 29, 2017

    @supra28

    @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.

  16. added this to the 1.x milestone on Jan 8, 2018
  17. gaearon commented on Jan 8, 2018

    @gaearon
    Contributor

    Closing in favor of #2956 which is more focused.

  18. locked and limited conversation to collaborators on Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions