Skip to content

Commit 6287bae

Browse files
dongj0316dongji136
and
dongji136
authored
Fixes #687 (#688)
Co-authored-by: dongji136 <[email protected]>
1 parent 38fc6b2 commit 6287bae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/lib/src/dev/remote-development.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type { ConfigTypeSet, VitePluginFederationOptions } from 'types'
1818
import { walk } from 'estree-walker'
1919
import MagicString from 'magic-string'
2020
import { readFileSync } from 'fs'
21+
import { posix } from 'path'
2122
import type { AcornNode, TransformPluginContext } from 'rollup'
2223
import type { ViteDevServer } from '../../types/viteDevServer'
2324
import {
@@ -380,6 +381,7 @@ export {__federation_method_ensure, __federation_method_getRemote , __federation
380381
const res: string[] = []
381382
if (shared.length) {
382383
const serverConfiguration = viteDevServer.config.server
384+
const base = viteDevServer.config.base
383385
const cwdPath = normalizePath(process.cwd())
384386

385387
for (const item of shared) {
@@ -393,7 +395,7 @@ export {__federation_method_ensure, __federation_method_getRemote , __federation
393395
const idx = moduleFilePath.indexOf(cwdPath)
394396

395397
const relativePath =
396-
idx === 0 ? moduleFilePath.slice(cwdPath.length) : null
398+
idx === 0 ? posix.join(base, moduleFilePath.slice(cwdPath.length)) : null
397399

398400
const sharedName = item[0]
399401
const obj = item[1]

0 commit comments

Comments
 (0)