因此,webpack并没有更新我所做的任何更改或重新编译build.js的更改。令人沮丧的问题。不确定交易是什么。真的可以使用一些帮助!谢谢!代码如下。Webpack开发服务器没有观看或更新文件
webpack.config.js
var webpack = require("webpack");
var path = require("path");
var DEV = path.resolve(__dirname, "dev");
var OUTPUT = path.resolve(__dirname, "output");
var config = {
watch: true,
devtool: 'inline-source-map',
entry: [
'webpack-dev-server/client?http://localhost:8080/',
'webpack/hot/only-dev-server',
DEV + "/App.jsx"
],
output: {
path: OUTPUT,
filename: "build.js"
},
module: {
loaders: [{
include: DEV,
loaders: ["react-hot", "babel"],
}]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
};
module.exports = config;
的package.json
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"react": "^15.2.0",
"react-dom": "^15.2.0",
"react-hot-loader": "^1.3.0",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
"babel": {
"presets": [
"es2015",
"react"
]
}
}
我跑./node_modules/.bin/webpack得到初步建立。
让我知道你是否需要更多信息。再次感谢。
+0
你尝试传递'-w'的命令如'的WebPack -w ' –
+0
'./node_modules/.bin/webpack -w' –
+0
我试过了,它会更新,但现在每次保存文件时,hot-update.js和hot-update.json都会放到我的输出文件夹中。 –