webpack从0开始搭建react的ts开发环境(9)

2020-01-21  本文已影响0人  汤姆猫_6074

本章介绍如何加入热更新
webpack从0开始搭建react的ts开发环境(8)
demo https://github.com/757566833/webpack-guide

1.加入热更新

yarn add  webpack-dev-server --dev

2.package.json修改

...
 "scripts": {
    "test": "tsc",
    "webpack": "webpack",
    "start":"webpack-dev-server"
  }
...

3.wepack.config.js修改

...
 mode: "development",
...
devServer: {
        contentBase: "./dist",
// host填写为0000是因为可能有remote开发的情况,0000不能访问就改成localhost
        host: "0.0.0.0",
    },
...

webpack从0开始搭建react的ts开发环境(10)

上一篇下一篇

猜你喜欢

热点阅读