问 题
标签 找不到 webpack》》》》
问题:
webpack 我想配置浏览器自动刷新 但是一直配置不成功
错误贴图:
具体配置代码:
1.webpack.config.js 中的配置
var webpack=require("webpack")
var webserver=require("webpack-dev-server")
var path= require("path");
module.exports={
entry:['webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8080',
'./app/main.js'
],
output:{
path:"./build",
filename:"bundle.js"
},
module:{
loaders:[
{
test:/\.css$/,loader:"style!css"
}
]
},
plugins:[
new webpack.BannerPlugin('This file is created by wanglu')
],
devServer:{
hot:true,
inline:true
}
}
2.package.json中的配置:
{
"name": "webpack-demo",
"version": "1.0.0",
"description": "an example for webpack",
"main": "bundle.js",
"dependencies": {},
"devDependencies": {
"react-hot-loader": "^1.3.1",
"webpack": "^1.14.0",
"webpack-dev-server": "^1.16.2",
"css-loader":"0.26.1",
"style-loader":"0.13.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"dev": "webpack-dev-server --devtool eval --progress --colors --hot --content-base build"
},
"author": "CoquettishPoppy",
"license": "ISC"
}
命令行代码:
解决了好久 解决不了 希望有人能帮我发现问题
解决方案
自己已经解决npm run dev
扫一扫关注IT屋
微信公众号搜索 “ IT屋 ” ,选择关注与百万开发者在一起