Passing the value of a variable to module.hot.accept in webpacks HMR has no effect

This works:

module.hot.accept('module/name');

And this doesn’t:

const m = 'module/name';
module.hot.accept(m);

Apparently the code is statically analyzed on the server side. Is there a way around this restriction? I couldn’t find any documentation mentioning that this is not possible.

Source: Ask Javascript Questions

LEAVE A COMMENT