vue-cli icon indicating copy to clipboard operation
vue-cli copied to clipboard

webpack module federation doesn't work after [email protected]

Open farhadnowzari opened this issue 2 years ago • 14 comments

Version

5.0.0-rc.0

Reproduction link

github.com

Environment info

  System:
    OS: Windows 10 10.0.18363
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 14.17.4 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.24.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 95.0.4638.69
    Edge: Spartan (44.18362.1533.0)
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

serve the app-one project. server the consumer project. open the consumer server. You will see that it says it cannot load the remoteScript which probably is because of an error in the generated script and it doesn't happen in [email protected]

What is expected?

It is expected that the remote script runs to the end and initiate the remote namespace to be used inside the consumer project.

What is actually happening?

The remote namespace at the end of the script is always undefined. this part is also probably generated by webpack but I think the error is happening where vue-cli injects some additional codes in there right before the last line.


I have also a working example which you can check https://github.com/farhadnowzari/vue-cli-module-federation-working-example.

farhadnowzari avatar Nov 08 '21 12:11 farhadnowzari