-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible Webpack support? #14
Comments
If you take a look at api docs it's possible to provide additional scripts to pretty page handler. Would that be good enough? |
Yeah, I'll just have to find the time to create an error handler for webpack. |
=== Update === var Ouch = require('ouch')
var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin')
const { HotModuleReplacementPlugin, DefinePlugin, NoEmitOnErrorsPlugin } = webpack;
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach((name) => (
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) ))
module.exports = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
},
// cheap-module-eval-source-map is faster for development
devtool: '#cheap-module-eval-source-map',
devServer: {
host: '0.0.0.0',
port: 8800,
before(app) {
const ouch = new Ouch();
const { handlers: { PrettyPageHandler }} = Ouch;
const logError = () =>
console.log('Error handled');
app.use((err, req, res, next) => (
ouch.pushHandler(new PrettyPageHandler())
.handleException(err, req, res, logError)));
console.log(instance);
console.log(app);
},
},
plugins: [
new DefinePlugin({
'process.env': config.dev.env
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new HotModuleReplacementPlugin(),
new NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
})
]
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible that Ouch could support the Webpack dev server?
The text was updated successfully, but these errors were encountered: