run elm debug mode stuff

This commit is contained in:
notgne2 2020-02-14 23:12:52 -07:00
parent 3b48cf585d
commit ca08860b2f

View File

@ -10,6 +10,7 @@ const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const { JSDOM } = require('jsdom') const { JSDOM } = require('jsdom')
const tempy = require('tempy') const tempy = require('tempy')
const fs = require('fs') const fs = require('fs')
const webpack = require('webpack')
const magicFile = (text) => { const magicFile = (text) => {
const p = tempy.file() const p = tempy.file()
@ -110,6 +111,7 @@ const productionPlugins = [
]; ];
let plugins = (env, argv) => [ let plugins = (env, argv) => [
new webpack.HotModuleReplacementPlugin(),
new CopyPlugin([{ from: 'data', to: 'data' }, { from: 'wand.js', to: 'wand.js' }]), new CopyPlugin([{ from: 'data', to: 'data' }, { from: 'wand.js', to: 'wand.js' }]),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
hash: true, hash: true,
@ -145,11 +147,17 @@ module.exports = (env, argv) => ({
test: /\.elm$/, test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/], exclude: [/elm-stuff/, /node_modules/],
use: [ use: [
{ loader: 'elm-hot-webpack-loader' }, {
loader: 'elm-hot-webpack-loader',
options: {
debug: argv.mode != 'production',
}
},
{ {
loader: 'elm-webpack-loader', loader: 'elm-webpack-loader',
options: { options: {
optimize: argv.mode == 'production' optimize: argv.mode == 'production',
debug: argv.mode != 'production',
}, },
}, },
], ],
@ -168,6 +176,11 @@ module.exports = (env, argv) => ({
}, },
], ],
}, },
devServer: {
inline: true,
hot: true,
stats: 'errors-only'
},
optimization: { optimization: {
minimize: argv.mode == 'production', minimize: argv.mode == 'production',
minimizer: [ minimizer: [