为什么在打包之后就禁止模块热替换了,后期我想改代码,没有热替换不是很不方便?
Hot module reload is designed for development, not for production use. If you changed code, it's just a matter of replacing bundle, but you just saved some kilobytes of loading a HMR module & server resources to manage all HMR websocket connections.
模块热替换是为开发环境设计的,不适用于生产。如果你改变了代码,你只需要替换新生成的包,唯一缺点是打开的页面不会自动更新(通常你也不需要)。这省下了几 KB 的热替换模块加载器的文件大小和管理热替换的 websocket 资源。
Seems like the question has been answered if google translate is correct
Thanks, but i feel it seems more easier for it can still do module hot replacement when i modify code. So may you can provide some options for this feature ?
谢谢,但是我觉得觉得修改代码之后仍然可以使用热更新是更方便的,所以可以提供一个选项供使用者选择吗?
@YangGoldDragon It can be easy to use in your case, but it's not that easy to implement. In general, it's not that useful in production but if you need, you can just implement it yourself.
Anyway, HMR is not that stable for production use, and it can cause problems in your app if your code is not properly organized. You'll find it throw errors during your development, it doesn't simply work every time you update your code.
Most helpful comment
Hot module reload is designed for development, not for production use. If you changed code, it's just a matter of replacing bundle, but you just saved some kilobytes of loading a HMR module & server resources to manage all HMR websocket connections.
模块热替换是为开发环境设计的,不适用于生产。如果你改变了代码,你只需要替换新生成的包,唯一缺点是打开的页面不会自动更新(通常你也不需要)。这省下了几 KB 的热替换模块加载器的文件大小和管理热替换的 websocket 资源。