Created
December 4, 2016 13:02
-
-
Save mckn/bfc640a994429f06180c50e45b49f0c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
const path = require('path'); | |
module.exports = { | |
entry: [ | |
'babel-polyfill', | |
path.join(__dirname, '/src/index.js') | |
], | |
devtool: "source-map", | |
output: { | |
path: path.join(__dirname, '/public'), | |
filename: 'bundle.js', | |
publicPath: 'assets', | |
}, | |
module: { | |
loaders: [{ | |
test: /\.js$/, | |
exclude: /(node_modules)/, | |
loader: 'babel-loader', | |
query: { | |
presets: ['latest', 'react'] | |
} | |
} | |
] | |
}, | |
plugins: [ | |
new webpack.NoErrorsPlugin(), | |
new webpack.HotModuleReplacementPlugin() | |
], | |
devServer: { | |
contentBase: 'public', | |
hot: true, | |
inline: true, | |
port: 8080, | |
host: 'localhost', | |
proxy: { | |
'/**': { | |
target: '/index.html', | |
secure: false, | |
bypass: function(req, res, opt) { | |
var hotupd = /(\/[a-z0-9\.]*\.hot-update\..*)$$/gi | |
var match = hotupd.exec(req.path); | |
if(match && match[1]) { | |
return match[1]; | |
} | |
if (req.headers.accept && req.headers.accept.indexOf('html') !== -1) { | |
return '/index.html'; | |
} | |
} | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment