Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: module-federation #1526

Closed
avkis opened this issue Feb 6, 2024 · 3 comments
Closed

[Bug]: module-federation #1526

avkis opened this issue Feb 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@avkis
Copy link

avkis commented Feb 6, 2024

Version

System: Windows 10
Browser: Google Chrome
npmPackages: 
  "devDependencies": {
    "@rsbuild/core": "^0.3.11",
    "@rsbuild/plugin-react": "^0.3.11"
  }

Details

Module-federation example doesn't work outside of the main project.
RsBuildModuleFederationRemote
RsBuildModuleFederationHost

Reproduce link

The issue concerns of the code from your repo.

Reproduce Steps

  1. Extract the module-federation folder from the examples directory of main repository (https://github.com/web-infra-dev/rsbuild) to a separate folder.
  2. Install dependency for each projects (host and remote).
  3. Run pnpm run dev in the remote folder (this project will run perfectly).
  4. Run pnpm run dev in the host folder (this one throws an error:
    error Compile error:
    Failed to compile, check the errors for troubleshooting.
    File: ./src/App.js
    × Resolve error: Can't resolve 'remote/Button' in 'D:\Dev\Education\ModuleFederation\module-federation\host\src'
    ╭─[1:1]
    1 │ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
    2 │ import React from "react";
    3 │ const RemoteButton = /#PURE/ React.lazy(()=>import("remote/Button"));
    · ───────────────────────
    4 │ _c = RemoteButton;
    5 │ const App = ()=>/#PURE/ _jsxDEV("div", {
    ╰────

    )
@avkis avkis added the bug Something isn't working label Feb 6, 2024
@avkis
Copy link
Author

avkis commented Feb 6, 2024

RsBuildModuleFederationRsbuildConfigExport

@chenjiahan
Copy link
Member

Try Rsbuild 0.4.0

@avkis
Copy link
Author

avkis commented Feb 6, 2024

It works. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants