I am new to JS development, in an attempt to hot load changes using webpack-dev-server I keep above exception. The exact stack is:
Error: `output.path` needs to be an absolute path or `/`.
at Object.Shared.share.setFs (/Users/mybox/work/day1/ex6/node_modules/webpack-dev-middleware/lib/Shared.js:88:11)
at Shared (/Users/mybox/work/day1/ex6/node_modules/webpack-dev-middleware/lib/Shared.js:214:8)
at module.exports (/Users/mybox/work/day1/ex6/node_modules/webpack-dev-middleware/middleware.js:22:15)
at new Server (/Users/mybox/work/day1/ex6/node_modules/webpack-dev-server/lib/Server.js:56:20)
at startDevServer (/Users/mybox/work/day1/ex6/node_modules/webpack-dev-server/bin/webpack-dev-server.js:379:12)
at processOptions (/Users/mybox/work/day1/ex6/node_modules/webpack-dev-server/bin/webpack-dev-server.js:317:3)
at Object.<anonymous> (/Users/mybox/work/day1/ex6/node_modules/webpack-dev-server/bin/webpack-dev-server.js:441:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
Here are the webpack config files i have tried already:
module.exports = {
entry: "./client/app.jsx",
output: {
path: "dist/js",
filename: "bundle.js",
publicPath: "http://127.0.0.1:2992/js"
},
module: {
loaders: [
{
test: /.jsx?$/,
loader: "babel-loader",
include: /client/
}
]
}
};
And:
module.exports = {
entry: "./client/app.jsx",
output: {
path: "/Users/mybox/work/day1/ex6/dist/js",
filename: "bundle.js",
publicPath: "http://127.0.0.1:2992/js"
},
module: {
loaders: [
{
test: /.jsx?$/,
loader: "babel-loader",
include: /client/,
query: {
presets:['react']
}
}
]
}
};
Below is my package.json file
{
"name": "ex6",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"server": "node index.js",
"hot": "webpack-dev-server --inline --hot --port 2992 --progress --colors",
"dev": "webpack-dev-server --inline --dev --port 2992 --progress --colors"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"babel-preset-es2015": "^6.22.0",
"hapi": "^16.1.0",
"inert": "^4.1.0"
},
"devDependencies": {
"babel": "^6.5.2",
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-preset-react": "^6.22.0",
"builder": "^3.2.1",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0"
},
"description": ""
}
See Question&Answers more detail:
os