vanyahuk
@vanyahuk

Как правильно настроить laravel-mix и react-hot-loader?

Как правильно настроить laravel-mix и react-hot-loader?
вот webpack.mix
let mix = require('laravel-mix')

mix.react('resources/assets/js/app.js', 'public/js');
//.sass('resources/assets/sass/app.scss', 'public/css');



mix.webpackConfig({

	output: {
		publicPath: "http://localhost:8080/"
	},

		devServer: {
			hot: true, // this enables hot reload
			inline: true, // use inline method for hmr
			contentBase: path.join(__dirname, "public"),
			https: false, //true
			port: 8080,
			headers: {"Access-Control-Allow-Origin": "*"},
			watchOptions: {
				exclude: [/bower_components/, /node_modules/]
			},
		},

			node: {
				fs: "empty",
				module: "empty"
			},


});


Mix.listen("configReady", webpackConfig => {

	if (Mix.isUsing("hmr")) {

		webpackConfig.entry = Object.keys(webpackConfig.entry).reduce(
			(entries, entry) => {
				entries[entry.replace(/^\//, "")] = webpackConfig.entry[entry];

				console.log(entries);
				return entries;
			},
			{}
		);

		webpackConfig.plugins.forEach(plugin => {
			if (plugin.constructor.name === "ExtractTextPlugin") {
				console.log(plugin.filename);
				plugin.filename = plugin.filename.replace(/^\//, "");
				console.log(plugin.filename);
			}
		});
	}
});


но почему-то не работает, хотя ошыбок нету
5b621bf06dc8f484563875.png
  • Вопрос задан
  • 487 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы