// Live Reload
devServer: {
contentBase: path.resolve(__dirname, './build'),
watchOptions: {
poll: true
},
compress: true,
watchContentBase: true,
compress: true,
port: 8080,
publicPath: '/',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept',
'Access-Control-Allow-Credentials': true
}
},
devtool: 'source-maps',
mode: 'development',
entry: ['./src/index.js',
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server'
],
output: {
path: path.resolve(__dirname, './build'),
filename: 'lib/ps-chat-client.[hash].js',
library: 'bundle_[name]',
publicPath: './'
},
// No package
"start": "webpack-dev-server --hot --inline --color --progress --config webpack.config.js --open",
// Caso o HTML nao Atualize Junto
// Acrescentar o chokidar e mudar o server
// npm install chokidar --save
const chokidar = require('chokidar');
devServer: {
before(app, server) {
chokidar.watch([
'./src/**/*.html'
]).on('all', function() {
server.sockWrite(server.sockets, 'content-changed');
});
},