Я не могу понять как правильно настроить webpack-dev-server. Запускаю его через файл app.js
import express from 'express';
import webpack from 'webpack';
import webpackDevServer from 'webpack-dev-server';
import webpackConfig from './webpack.config.js';
const app = express();
new webpackDevServer(webpack(webpackConfig),{
publicPath: webpackConfig.output.publicPath,
hot: true,
historyApiFallback: true
}).listen(8080,'localhost',(err,res)=>{
if (err){
return console.log(err);
}
console.log(`server is up on port 8080`);
});
Сам webpack.config.js:
var path = require('path');
var webpack =require('webpack');
module.exports={
devtool:'eval-source-map',
entry:[
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./client/main.js'
],
output:{
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath:'/public/'
},
plugins:[
new webpack.HotModuleReplacementPlugin()
],
module:{
loaders:[
{
test:/\.jsx?$/,
loader:'babel-loader',
exclude:/node_modules/,
query: {
presets: ['es2015']
}
},
{
test:/\.css$/,
loader: 'style!css'
}
]
},
devServer:{
contentBase: './public'
}
}
Структура:
![875184648dea4404aa5f4b40b0cf35cb](https://habrastorage.org/files/875/184/648/875184648dea4404aa5f4b40b0cf35cb)
по адресу
localhost:8080 ничего не рендиться, просто Cannot GET /. В чем проблема?
Webpack билдит:
![5f80aa3c864b4866a924f4fad6f52ca4](https://habrastorage.org/files/5f8/0aa/3c8/5f80aa3c864b4866a924f4fad6f52ca4)
В консоле ничего
![edcd460f3520485da5b114f8c56ba2b2](https://habrastorage.org/files/edc/d46/0f3/edcd460f3520485da5b114f8c56ba2b2)
index.html
<html lang="en">
<head>
<title>Shorten link</title>
</head>
<body>
<div id='react-root'></div>
<script src="bundle.js"></script>
</body>
</html>