Hot Module Replacement for Elm using webpack.
JavaScript
146
58 commits
updated Jan 20, 2018
Hot code swapping for Elm.
This loader injects HMR support code to the Elm module generated by elm-webpack-loader.
$ npm install --save elm-webpack-loader elm-hot-loader
In your webpack.config.js file:
With webpack 2+
module.exports = {
module: {
rules: [{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
use: [
'elm-hot-loader',
'elm-webpack-loader',
]
}]
}
};
With webpack 1
module.exports = {
module: {
loaders: [{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
loader: 'elm-hot!elm-webpack'
}]
}
};
If you don't use elm-webpack-loader to compile Elm, just make sure webpack uses elm-hot to load your compiled js file. Add this to your webpack config file:
With webpack 2+
rules: [
// ...
{
test: /[YOUR_COMPILED_JS_FILE_NAME_HERE]\.js$/,
loader: 'elm-hot-loader',
}
// ...
]
With webpack 1
loaders: [
// ...
{
test: /[YOUR_COMPILED_JS_FILE_NAME_HERE]\.js$/,
loader: 'elm-hot',
}
// ...
]
You should also add the --hot flag when starting webpack.
This loader relies on elm-webpack-loader to compile Elm to JS.
You can find an example project at elm-hot-loader-starter.
JavaScript
100.0%
Hot Module Replacement for Elm using webpack.
JavaScript
146
58 commits
updated Jan 20, 2018
Hot code swapping for Elm.
This loader injects HMR support code to the Elm module generated by elm-webpack-loader.
$ npm install --save elm-webpack-loader elm-hot-loader
In your webpack.config.js file:
With webpack 2+
module.exports = {
module: {
rules: [{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
use: [
'elm-hot-loader',
'elm-webpack-loader',
]
}]
}
};
With webpack 1
module.exports = {
module: {
loaders: [{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
loader: 'elm-hot!elm-webpack'
}]
}
};
If you don't use elm-webpack-loader to compile Elm, just make sure webpack uses elm-hot to load your compiled js file. Add this to your webpack config file:
With webpack 2+
rules: [
// ...
{
test: /[YOUR_COMPILED_JS_FILE_NAME_HERE]\.js$/,
loader: 'elm-hot-loader',
}
// ...
]
With webpack 1
loaders: [
// ...
{
test: /[YOUR_COMPILED_JS_FILE_NAME_HERE]\.js$/,
loader: 'elm-hot',
}
// ...
]
You should also add the --hot flag when starting webpack.
This loader relies on elm-webpack-loader to compile Elm to JS.
You can find an example project at elm-hot-loader-starter.
JavaScript
100.0%