ts-loader icon indicating copy to clipboard operation
ts-loader copied to clipboard

Blocker runtime error if using webpack federation plugin

Open levymoreira opened this issue 4 years ago • 3 comments

Expected Behaviour

ts-loader should work with webpack and the native plugin ModuleFederationPlugin.

Actual Behaviour

If ModuleFederationPlugin gets enabled a invalid bundle is generated and a runtime error breaks the loading of the source. Error: Uncaught Error: Shared module is not available for eager consumption

Steps to Reproduce the Problem

Create a simple project with webapack and ts-loader and ModuleFederationPlugin ( example bellow ).

Location of a Minimal Repository that Demonstrates the Issue.

If you comment the ts-loader config and uncomment babel it works just fine. It also works if we remove ModuleFederationPlugin.

https://github.com/levymoreira/ts-loader-federation-issue/blob/master/webpack.config.js#:~:text=//-,ts%2Dloader,-example%2C%20only%20works

levymoreira avatar Jan 12 '22 17:01 levymoreira

We haven't done any work to actively support the ModuleFederationPlugin. It's possible some would be necessary to get it working. If you'd like to take a look we'd certainly look at a PR.

johnnyreilly avatar Jan 12 '22 18:01 johnnyreilly

@levymoreira problem is with your typescript configuration. You need to change module code generation to "ESNext" instead of "commonjs".

https://github.com/levymoreira/ts-loader-federation-issue/blob/649eb8ed3a79628d8ee62dc85aeb1a0d34afe753/tsconfig.json#L8

neytema avatar Feb 20 '22 23:02 neytema

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 28 '22 01:04 stale[bot]