Skip to content

Hot reload doesn't work #395

Closed
Closed

Description

@kutomer

Hello,
When I execute npm start things work just as I expect them to.

But, when editing a file I see that webpack detects the change and recompile. ("Bundle is now invalid.. Bundle is now valid)
on the client side the change doesn't take affect.
When I try to refresh the page I can't find the files any more, only the bundled version (and one ctrl.ts) , so I have to rerun npm start

Maybe I'm just doing something wrong?
Tried running npm run watch alongside and change HMR to false, can't find a solution yet.

Thank you very much for your help.

Activity

  1. sasidhar commented on Mar 8, 2016

    @sasidhar

    @kutomer Is it possible to share some logs? May be that will help us to find the issue.

  2. kutomer commented on Mar 8, 2016

    @kutomer
    Author

    @sasidhar of course, thank you for your quick reply.
    Here are the logs I'm getting after running npm start, it's quite long so I'm posting only the start and the end of it (I'm not getting any errors \ warnings)

    > angular2-webpack-starter@3.0.0 server:dev /Users/kutomer/test
    > webpack-dev-server --inline --progress --profile --colors --watch --display-error-details --display-cached  --content-base src/ "--hot"
                                                                                                                                                                                70% 2/2 build moduleshttp://localhost:3000/
    webpack result is served from /
    content is served from /Users/kutomer/test/src
    404s will fallback to /index.html                                                                                                                                           46% 3/5 build modulests-loader: Using typescript@1.8.2 and /kutomer/test/tsconfig.json                                                                                 2540ms1325ms optim103ms emit
    Hash: e24a1fc1280a80452ba7
    Version: webpack 1.12.14
    Time: 8328ms
                                     Asset       Size  Chunks             Chunk Names
        assets/icon/android-icon-96x96.png     5.6 kB          [emitted]  
                       polyfills.bundle.js     679 kB       0  [emitted]  polyfills
                            main.bundle.js    1.54 MB       2  [emitted]  main
                             polyfills.map     612 kB       0  [emitted]  polyfills
                                     1.map    1.03 kB       1  [emitted]  
                                  main.map    2.45 MB       2  [emitted]  main
                          assets/data.json   30 bytes          [emitted]  
                         assets/humans.txt  251 bytes          [emitted]  
                      assets/manifest.json  769 bytes          [emitted]  
                         assets/robots.txt   31 bytes          [emitted]  
                  assets/service-worker.js   44 bytes          [emitted]  
                       assets/css/.gitkeep   14 bytes          [emitted]  
               assets/img/angular-logo.png      19 kB          [emitted]  
        assets/img/angularclass-avatar.png    32.8 kB          [emitted]  
          assets/img/angularclass-logo.png    36.7 kB          [emitted]  
                 assets/img/poepleIcon.png    4.99 kB          [emitted]  
                                1.chunk.js    1.64 kB       1  [emitted]  
             assets/icon/browserconfig.xml  281 bytes          [emitted]  
                                index.html    2.67 kB          [emitted]  
    chunk    {0} polyfills.bundle.js, polyfills.map (polyfills) 626 kB [rendered]
    

    After that it just start to log for each file the have built, for example:
    [6] (webpack)-dev-server/~/sockjs-client/~/inherits/inherits_browser.js 672 bytes {0} [built]

    And the log ends with: webpack: bundle is now VALID.

    When I change a file:

    webpack: bundle is now INVALID.                                                                                                                                      2505ms 663ms optimi24ms emit
    Hash: 3a2b36434fb7f46979ee
    Version: webpack 1.12.14
    Time: 4183ms
                                   Asset      Size  Chunks             Chunk Names
                     polyfills.bundle.js    679 kB       0  [emitted]  polyfills
                          main.bundle.js   1.54 MB       2  [emitted]  main
    2.e24a1fc1280a80452ba7.hot-update.js   3.22 kB       2  [emitted]  main
    e24a1fc1280a80452ba7.hot-update.json  36 bytes          [emitted]  
                           polyfills.map    612 kB       0  [emitted]  polyfills
                                main.map   2.98 kB    2, 2  [emitted]  main, main
    chunk    {0} polyfills.bundle.js, polyfills.map (polyfills) 626 kB [rendered]
         + 105 hidden modules
    chunk    {1} 1.chunk.js, 1.map 1.48 kB {2}
         + 1 hidden modules
    chunk    {2} main.bundle.js, 2.e24a1fc1280a80452ba7.hot-update.js, main.map, main.map (main) 1.5 MB {0} [rendered]
      [356] ./src/app/home/home.ts 3.03 kB {2} [built]
           ... -> factory:1ms building:0ms dependencies:0ms
         + 259 hidden modules
    Child html-webpack-plugin for "index.html":
        chunk    {0} index.html 415 kB
             + 3 hidden modules
    webpack: bundle is now VALID.
    

    I forgot to mention my spec in my previous message:
    node: v5.7.0
    npm: 3.6.0
    os: OS x Yosemite 10.10.5

  3. sasidhar commented on Mar 8, 2016

    @sasidhar

    @kutomer, seems everything looks fine.

    • Are there any errors in the browser console?
    • Are you using angular2-webpack-starter with only code changes or some configuration changes (webpack-config.js, package.json etc) too?

    I am on Ubuntu.

  4. kutomer commented on Mar 9, 2016

    @kutomer
    Author

    Thanks a lot.
    I've tried to reinstall everything all over again it's working.

    Btw, in your README file you said to install webpack-dev-server globally, but when doing so there is Unmet peer dependency warning.

  5. PatrickJS commented on Mar 13, 2016

    @PatrickJS
    Owner

    @kutomer I'm going to close this. If you still have a problem with hot reloading can you own another issue thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions