module-federation/vite

`Failed to parse URL ` in latest

Closed this issue · 7 comments

Latest is broken.

I pulled latest from git and get this error when trying to get example running. A build from Sunday doesn't have that issue

Forced re-optimization of dependencies
node:internal/deps/undici/undici:12618
    Error.captureStackTrace(err, this);
          ^

TypeError: Failed to parse URL from http://localhost:5173C:\code\temp\mf-vite\node_modules\.pnpm\an-empty-js-file@1.0.0\node_modules\an-empty-js-file\empty.js?__mf__wrapRemoteEntry__
    at node:internal/deps/undici/undici:12618:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:796:36)
      at new Request (node:internal/deps/undici/undici:6108:25)
      at fetch (node:internal/deps/undici/undici:10396:25)
      at fetch (node:internal/deps/undici/undici:12617:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:79:16)
      at Server.<anonymous> (C:\code\temp\mf-vite\lib\index.cjs:230:9)
      at Object.onceWrapper (node:events:632:28)
      at Server.emit (node:events:530:35)
      at emitListeningNT (node:net:1931:10)
      at process.processTicksAndRejections (node:internal/process/task_queues:81:21) {
    code: 'ERR_INVALID_URL',
    input: 'http://localhost:5173C:\\code\\temp\\mf-vite\\node_modules\\.pnpm\\an-empty-js-file@1.0.0\\node_modules\\an-empty-js-file\\empty.js?__mf__wrapRemoteEntry__'
  }
}

Node.js v20.12.2
 ELIFECYCLE  Command failed with exit code 1.

@gioboa @zhangHongEn do you get examples working for you?

@gioboa @zhangHongEn do you get examples working for you?

@husayt I added remoteEntry filename support for hash yesterday, it seems incompatible with Windows

@zhangHongEn let's use https://unjs.io/packages/pathe instead of path.js that will take care of most of issues for us.

I will support dynamic import tonight, and I will fix it later. But I don't have a Windows device, so it's very difficult to deal with such problems.
The problem with windows appears in this file
https://github.com/module-federation/vite/blob/new-config/src/utils/vitePluginAddEntry.ts

@zhangHongEn let's use https://unjs.io/packages/pathe instead of path.js that will take care of most of issues for us.

I'll try it tonight

@husayt fixed

Yes, @zhangHongEn that has been fixed in the latest. Thank you