Scoped package and dynamic require

When using “dynamic requires”, it seems that webpack is unable to deal with npm scoped packages, i.e.

require("my-module/lib/" + dynamicOne + "/" + dynamicTwo + ".ext");

works while

require("@my/module/lib/" + dynamicOne + "/" + dynamicTwo + ".ext");

doesn’t. Moreover, I tried to use the following alias as a workaround:

"my-module": "@my/module"

to no avail.

Searching turned up nothing except #1256 which seems to be a similar issue, albeit a different one.

Author: Fantashit

1 thought on “Scoped package and dynamic require

Comments are closed.