Fix webpack HMR

This commit is contained in:
QWp6t
2016-09-11 11:39:48 -07:00
parent 3516629add
commit 10899cf2cd
11 changed files with 154 additions and 53 deletions

View File

@@ -1,21 +1,24 @@
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const url = require('url');
const webpack = require('webpack');
const BrowserSyncPlugin = require('./webpack.plugin.browsersync');
const config = require('./config');
module.exports = {
output: { pathinfo: true },
debug: true,
devTool: 'cheap-module-source-map',
devtool: '#cheap-module-source-map',
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
WEBPACK_PUBLIC_PATH: JSON.stringify(config.publicPath),
}),
new BrowserSyncPlugin({
host: url.parse(config.proxyUrl).hostname,
port: url.parse(config.proxyUrl).port,
proxy: config.devUrl,
files: [
'templates/**/*.php',
'src/**/*.php',
],
target: config.devUrl,
publicPath: config.publicPath,
proxyUrl: config.proxyUrl,
browserSyncOptions: { files: config.watch },
}),
],
};