webpack --watch isn't compiling changed files

后端 未结 30 1056
眼角桃花
眼角桃花 2020-12-02 06:00

I tried running webpack --watch and after editing my JS files, it doesn\'t trigger an auto-recompilation.

I\'ve tried reinstalling webpack

相关标签:
30条回答
  • 2020-12-02 06:30

    Adding the following code to my webpack configuration file fixed the issue for me. Don't forget to ignore your node_modules folder, as that would kill performance for HMR (Hot Module Replacement):

    watchOptions: {
      poll: true,
      ignored: /node_modules/
    }
    
    0 讨论(0)
  • 2020-12-02 06:31

    For me, creating folders and files in VS Code was the issue. To fix, I re-cloned my repo and this time, created new folders and files through the command line instead of Code. I think Code was corrupting the files for some reason. I saw the application just updated so maybe it's a new bug.

    0 讨论(0)
  • 2020-12-02 06:33

    For me deleting node_modules and doing npm install or yarn again to install all the packages solved the problem

    0 讨论(0)
  • 2020-12-02 06:34

    I came across this question when I was having a similar issue-- it appeared that webpack was not rebundling, even when running webpack --config.

    I even deleted bundle.js and the webpage was still displaying as before my edits.

    For those of you who get this same problem, I finally did the 'empty cache and hard reload' option in chrome (right click the reload button with the devtools open) and that did that trick

    0 讨论(0)
  • 2020-12-02 06:35

    Work for me in Laravel Homestead

    --watch --watch-poll
    
    0 讨论(0)
  • 2020-12-02 06:36

    It wasn't recompiling for me but then I realized / remembered that webpack watches the dependency graph and not just a folder (or files). Sure enough the files I was changing weren't part of that graph yet.

    0 讨论(0)
提交回复
热议问题