Giter Site home page Giter Site logo

Comments (5)

Blubiubiu avatar Blubiubiu commented on August 16, 2024

您现在可以根据1.0.5的改动来添加html热更新了

from webpack4_mpa_demo.

DemoorBug avatar DemoorBug commented on August 16, 2024

这个raw-loaderhtml-loader一起使用会有bug, 去除html-loader后页面引入的图片路径就不会处理。我下载了你的代码,也有同样的问题!!

from webpack4_mpa_demo.

DemoorBug avatar DemoorBug commented on August 16, 2024

我找到了解决方法

{
  test: /\.html$/,
  use: [
    {
      loader: 'html-loader?config=raw-loader',
      options: {
        attrs: ['img:src']
      }
    },
  ]
}

不过这种方法只能做到刷新页面,热更新还是不行,不过好像找不到更优的方案了

from webpack4_mpa_demo.

DemoorBug avatar DemoorBug commented on August 16, 2024

还有index.html文件引入的时候要区分开发环境,不然打包的时候会把html打包到js中

if (process.env.NODE_ENV !== 'production') {
  require('./index.html');
}

from webpack4_mpa_demo.

Blubiubiu avatar Blubiubiu commented on August 16, 2024

感谢您的建议,已经做出修改,如果您在使用中还有好的意见或建议,可以继续提issues或者pr,再次感谢支持...

from webpack4_mpa_demo.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.