Skip to content

Commit

Permalink
fix: Pass down webpackHot options to fastify-webpack-hmr plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbachmann committed Jul 9, 2024
1 parent 4b769c0 commit efa410a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -154,7 +155,8 @@ async function webpackPlugin (fastify, opts) {
},
...opts.webpackDev,
publicPath: publicAssetsPath
}
},
webpackHot
} : {
config: {
...webpackConfig,
Expand All @@ -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
Expand Down

0 comments on commit efa410a

Please sign in to comment.