Build won't run with Laravel Mix and hot module reload enabled
alexpcoleman opened this issue · comments
Issue description or question
The build just won't run when using Mix w/ HMR. My guess is that the clean somehow confusing the hot build.
Webpack Config
require('dotenv').config()
let mix = require('laravel-mix')
.setPublicPath('build/dist')
.setResourceRoot('/dist');
const webpack = require('webpack')
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
/**
* Settings.
*/
mix.webpackConfig({
plugins: [
// Ignore all locale moment.js files, except for the en one.
// https://stackoverflow.com/a/25426019
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
],
module: {
// ...
},
resolve: {
// ...
},
});
// Enable source maps & set hot reload URL for development.
if ( ! mix.inProduction())
{
mix.sourceMaps()
mix.webpackConfig({
devServer: {
sockHost: 'sm-craft-hot.test',
sockPort: 443
},
plugins: [
new CleanWebpackPlugin(),
],
})
mix.options({
hmrOptions: {
host: 'sm-craft-hot.test',
port: 443
},
processCssUrls: false
})
}
/**
* Commands.
*/
// Main Vue app w/ dashboard theme.
mix.js([
'resources/js/app.js',
'resources/js/dashboard/theme/main.js',
], 'app.js');
// Dashboard styles.
mix.sass('resources/sass/dashboard/dashboard.scss', 'dashboard.css')
Environment
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
Memory: 54.70 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.15.0 - ~/.nvm/versions/node/v8.15.0/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v8.15.0/bin/npm
Just doesn't ever complete a build.