webpack-dev-server hot reload not working

前端 未结 11 1947
囚心锁ツ
囚心锁ツ 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:35

    Check your console logs if it has below error then add cors to your webpack dev server file

    No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin react hot reload
    

    Ideally add below entry in you dev server js

    headers: { "Access-Control-Allow-Origin": "*" },
    

提交回复
热议问题