In the latest webpack version (5+) when i try to use exported content of dynamic loaded module i can't see its property (got undefined) - the only way is to use module.default.method
instead of module.method
. I noticed that using file-saver
library, but also reproduced it with simple module - i recreated the way saveAs
function is exported in file-saver.
Here is the problematic repo:
https://github.com/snffquake/webpack_demo
With webpack 5+ both console.log
s return undefined
s and with webpack 4 i get functions as expected. I can't see any breaking changes in the webpack changelog that could cause that. Also, I am not sure if file-saver
exports function in the right way, however it worked differently in the previous webpack versions.
So the question is, is the correct behavior or am i doing something wrong?