webpack-serveがあっという間に使われなくなったので、
webpack-dev-serverに戻したバージョンをメモしておく。
webpack.config.js
// 省略
if (MODE === "development") {
console.log("Building for dev...");
module.exports = merge(common, {
plugins: [
// Suggested for hot-loading
new webpack.NamedModulesPlugin(),
// Prevents compilation errors causing the hot loader to lose state
new webpack.NoEmitOnErrorsPlugin()
],
module: {
rules: [
{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
use: [
{ loader: "elm-hot-webpack-loader" },
{
loader: "elm-webpack-loader",
options: {
// add Elm's debug overlay to output
debug: true,
forceWatch: true
}
}
]
}
]
},
devServer: {
inline: true,
stats: "errors-only",
contentBase: path.join(__dirname, "src/assets"),
historyApiFallback: true,
// feel free to delete this section if you don't need anything like this
before(app) {
// on port 3000
app.get("/test", function(req, res) {
res.json({ result: "OK" });
});
}
},
watch:true,
watchOptions:{
aggregateTimeout: 300,
poll:1000
}
});
}
// 省略
サンプル
- 以下、elm-webpack-starterで色々試してみたログ