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

Cannot make Remix working with @module-federation/vite #10239

Open
Shurna83 opened this issue Nov 18, 2024 · 2 comments
Open

Cannot make Remix working with @module-federation/vite #10239

Shurna83 opened this issue Nov 18, 2024 · 2 comments

Comments

@Shurna83
Copy link

Reproduction

In this repo: https://github.com/Shurna83/remix-mf

  • run npm run build

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 2.18 GB / 15.73 GB
  Binaries:
    Node: 22.11.0 - C:\Program Files\nodejs\node.EXE      
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.12.2 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (129.0.2792.89)
    Internet Explorer: 11.0.19041.4355

Used Package Manager

npm

Expected Behavior

I would like to implement a Remix app where one of the routes loads a federated module.
In the linked repo:

  • package remix-host: the page mfe.tsx at route /mfe will load a federated module
  • package remote: the module exposes a simple React component via module federation

I was expecting the npm run build command to complete successfully and at runtime the federated component to be consumed properly by the Remix host app

Actual Behavior

The command npm run build fails with the following error

vite v5.4.11 building SSR bundle for production...
✓ 0 modules transformed.
x Build failed in 36ms
[add-entry] ENOENT: no such file or directory, open 'C:\DEV\remix-mf\packages\remix-host\virtual:remix\server-build'
    at Object.readFileSync (node:fs:441:20)
    at Object.buildStart (C:\DEV\remix-mf\node_modules\@module-federation\vite\lib\index.cjs:109:41)
    at file:///C:/DEV/remix-mf/node_modules/rollup/dist/es/shared/node-entry.js:21199:40
    at async Promise.all (index 8)
    at PluginDriver.hookParallel (file:///C:/DEV/remix-mf/node_modules/rollup/dist/es/shared/node-entry.js:21127:9)
    at file:///C:/DEV/remix-mf/node_modules/rollup/dist/es/shared/node-entry.js:22077:13
    at catchUnfinishedHookActions (file:///C:/DEV/remix-mf/node_modules/rollup/dist/es/shared/node-entry.js:21545:16)
    at rollupInternal (file:///C:/DEV/remix-mf/node_modules/rollup/dist/es/shared/node-entry.js:22074:5)
    at Module.build (file:///C:/DEV/remix-mf/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:65443:14)
    at viteBuild (C:\DEV\remix-mf\node_modules\@remix-run\dev\dist\vite\build.js:212:5) {
  errno: -4058,
  code: 'PLUGIN_ERROR',
  syscall: 'open',
  path: 'C:\\DEV\\remix-mf\\packages\\remix-host\\virtual:remix\\server-build',
  pluginCode: 'ENOENT',
  plugin: 'add-entry',
  hook: 'buildStart'
}
npm error Lifecycle script `build` failed with error:
npm error code 1
npm error path C:\DEV\remix-mf\packages\remix-host
npm error workspace remix-host
npm error location C:\DEV\remix-mf\packages\remix-host
npm error command failed
npm error command C:\windows\system32\cmd.exe /d /s /c remix vite:build
@jrestall
Copy link
Contributor

The RR7 Rsbuild plugin might be a better option since it has first-class module federation support. web-infra-dev/rsbuild#4186

@ScriptedAlchemy
Copy link

Yes, Ive also designed the implementation specifically to support federation.
Note its not yet done, i need to ask Jacob a few more questions tomorrow - and smooth out a few other areas, as well and pull over a few more of remix conventions. But its pretty close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants