From efa410ad75f9817c8f12a038acdaf8a6fb576c1d Mon Sep 17 00:00:00 2001 From: Marc Bachmann Date: Tue, 9 Jul 2024 12:02:30 +0200 Subject: [PATCH] fix: Pass down webpackHot options to fastify-webpack-hmr plugin --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0d59e70..72faad4 100644 --- a/index.js +++ b/index.js @@ -143,6 +143,7 @@ async function webpackPlugin (fastify, opts) { compiledPromise.then(() => next()) }) + const webpackHot = opts.webpackHot const webpackConfig = opts.webpackConfig || require(path.resolve('./webpack.config')) const isWebpack4 = module.parent.require('webpack/package.json').version[0] === '4' @@ -154,7 +155,8 @@ async function webpackPlugin (fastify, opts) { }, ...opts.webpackDev, publicPath: publicAssetsPath - } + }, + webpackHot } : { config: { ...webpackConfig, @@ -165,7 +167,8 @@ async function webpackPlugin (fastify, opts) { webpackDev: { ...opts.webpackDev, publicPath: publicAssetsPath - } + }, + webpackHot }).after((err) => { if (err) throw err fastify.webpack.compiler.hooks.assetEmitted