Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build won't run with Laravel Mix and hot module reload enabled #172

Open
alexpcoleman opened this issue Feb 6, 2020 · 0 comments
Open

Comments

@alexpcoleman
Copy link

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant