I’m trying to load hotModuleReplacement webpack plugin in my TwilioFlex plugin but I cannot figure out how to do it.
As suggested in the documentation, I try to modify the config object from the webpack.config.js file in the root folder.
Here is my code:
module.exports = (config, { isProd, isDev, isTest }) => {
/**
* Modify the configuration and then return it
*/
//
if(isDev) {
config.plugins.push(new webpack.HotModuleReplacementPlugin())
}
return config;
}
Sadly, it doesn’t work. Application crashes with the following error:
dental-twilio | TypeError: Cannot read properties of undefined (reading 'tap')
dental-twilio | at /app/node_modules/webpack/lib/HotModuleReplacementPlugin.js:388:32
dental-twilio | at SyncHook.eval [as call] (eval at create (/root/.twilio-cli/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:9:1)
dental-twilio | at SyncHook.lazyCompileHook (/root/.twilio-cli/node_modules/tapable/lib/Hook.js:154:20)
dental-twilio | at Compiler.newCompilation (/root/.twilio-cli/node_modules/webpack/lib/Compiler.js:631:26)
dental-twilio | at /root/.twilio-cli/node_modules/webpack/lib/Compiler.js:667:29
dental-twilio | at AsyncSeriesHook.eval [as callAsync] (eval at create (/root/.twilio-cli/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
dental-twilio | at AsyncSeriesHook.lazyCompileHook (/root/.twilio-cli/node_modules/tapable/lib/Hook.js:154:20)
dental-twilio | at Compiler.compile (/root/.twilio-cli/node_modules/webpack/lib/Compiler.js:662:28)
dental-twilio | at /root/.twilio-cli/node_modules/webpack/lib/Watching.js:77:18
dental-twilio | at AsyncSeriesHook.eval [as callAsync] (eval at create (/root/.twilio-cli/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
Thanks in advance for your help.