webpack-dev-server 无法热更新
来源:3-8 webpack-dev-server
jeanneze
2017-11-28
package.json配置片段:
"scripts": {
"dev": "set WEBPACK_ENV=dev && webpack-dev-server --inline --port 8099",
"dev-lx": "WEBPACK_ENV=dev webpack-dev-server --inline --port 8099",
"build": "set WEBPACK_ENV=online && webpack -p",
"build-lx": "WEBPACK_ENV=online webpack -p"
},
webpack.config相关配置
// 环境变量配置, dev / online
var WEBPACK_ENV = process.env.WEBPACK_ENV || 'dev';
if('dev' === WEBPACK_ENV) {
config.entry.common.push('webpack-dev-server/client?http://localhost:8099/')
}
无法热更新,本地有vue2项目,当时安装的是webpack2.0,项目打包需要用,全局被安装上的webpack-dev-server 是v2.4.5的,现在的项目无法热更新,刷新才能看到效果,如何解决,在不影响现有vue2项目的基础上
1回答
-
"dev": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --port 8099",
用这样的,就跟全局的没关系了,不用全局的组件了
052018-02-08
相似问题