TypeStrong / TypeStrong/ts-loader

Blocker runtime error if using webpack federation plugin

Open
#1,397 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
TypeScript
Stars
3.5k
Forks
439
Avg merge
17h 17m
Merged PRs (30d)
2

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked minimal repository's webpack.config.js and reproduce the invalid bundle using ts-loader with ModuleFederationPlugin. Compare the ts-loader configuration with the working babel configuration, then verify that the generated bundle loads without the “Shared module is not available for eager consumption” runtime error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.