webpack-dev-server hot reload not working

前端 未结 11 1990
囚心锁ツ
囚心锁ツ 2020-12-24 06:51

My file structure is:

dist
  css
    style.css
  index.html
  js
    bundle.js
src
  css
    style.css
  index.html
  js
    main.js
node_modules
webpack.con         


        
11条回答
  •  盖世英雄少女心
    2020-12-24 07:23

    When using webpack-dev-server, it builds all files internally and does not spit them out into your output path. Running webpack alone, without the dev server, does the actual compilation to disk. The dev server does everything in memory which speeds up re-compilation by a lot.

    To fix your hot reload issue, set the content base to your source directory and enable inline-mode

    Like so:

    webpack-dev-server --content-base src --hot --inline
    

提交回复
热议问题