ScriptedAlchemy / webpack-external-import

Dynamically import modules from other webpack bundles. Painless code sharing between separate apps
BSD 3-Clause "New" or "Revised" License
415 stars 42 forks source link

Does not work with yalc #174

Closed blackarctic closed 4 years ago

blackarctic commented 4 years ago

I am unable to develop a package locally with yalc with module federation. This is particularly a need for developing stateful packages.

Steps to reproduce:

  1. Create a local package called my-package. Run yalc publish inside it.
  2. In an app using module federation, run yalc add my-package and add my-package to shared in ModuleFederationPlugin.
  3. Run webpack.

Result: An error is thrown:

ERROR in overridable my-package
Module not found: Error: Can't resolve 'my-package' in '/Users/nick/my-app'
blackarctic commented 4 years ago

Solved. package.json must have an entrypoint OR your package must have an index.js file at the root. Then this appears to work fine.