Closed Sdju closed 9 months ago
1) Install a library (commonjs) that exports function as default. E.g dayjs 2) Make it a shared library 3) Import it and use as a function
dayjs
The dependency should work
%Name% isn't a function
function flattenModule(module, name) { if (module.default) module = Object.assign({}, module.default, module); moduleCache[name] = module; return module; }
After flattenModule, if we have a function in module.default, it won't be a function anymore cause of Object.assign
flattenModule
module.default
fixed in 1.3.3 https://github.com/originjs/vite-plugin-federation/commit/d60c019b288eb00337e38661985850bf8b426d34
Versions
Reproduction
Steps to reproduce
1) Install a library (commonjs) that exports function as default. E.g
dayjs
2) Make it a shared library 3) Import it and use as a functionWhat is Expected?
The dependency should work
What is actually happening?
%Name% isn't a function
Reason
After
flattenModule
, if we have a function inmodule.default
, it won't be a function anymore cause of Object.assign