Webpack Hot-Module Replacement Preprocessor and Runtime for KnockoutJS
- You are using webpack (and the webpack-dev-server)
- You are using babel (>=6)
.babelrc
{
"plugins": ["ko-hot-loader/babel"]
}
2a. Add HMR Entries and Plugin to your Webpack config and hot: true, publicPath: 'http://localhost:8080/'
to your dev server config
webpack.config.js
entry: [
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8080/',
'./app.js'
],
plugins: [
new webpack.HotModuleReplacementPlugin()
]
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const config = { entry: ... }
const compiler = webpack(config)
const server = new DevServer(compiler, {
hot: true,
publicPath: 'http://localhost:8080/'
})
or
webpack-dev-server --hot --inline --config webpack.config.js