Skip to content

Why does' Failed to locate remote 'appear when I change' remote 'to' remote1 '? #13

@Romio-L

Description

@Romio-L

After downloading your demo code, I changed the remote directory to 'remote1' and also changed the corresponding configuration to 'remote1'. Why did it fail to locate remote?
But I changed all the remote1s back to remote and they still run normally, so I don't understand where the components have already been registered and cannot be changed?

host's vite.config.js

federation({
	name: 'host',
	remotes: {
		remote: {
			type: 'module',
			name: 'remote1',
			entry: 'http://localhost:4174/remoteEntry.js',
			entryGlobalName: 'remote1',
			shareScope: 'default',
		},
	},
	exposes: {},
	filename: 'remoteEntry.js',
	shared: {
		react: {
			requiredVersion: dependencies.react,
			singleton: true,
		},
	},
})

host's App.tsx

const Remote = lazy(
	// @ts-ignore
	async () => import('remote1/remote-app')
);

remote1's vite.config.js

federation({
	filename: 'remoteEntry.js',
	name: 'remote1',
	exposes: {
		'./remote-app': './src/App.tsx',
	},
	remotes: {},
	shared: {
		react: {
			requiredVersion: dependencies.react,
			singleton: true,
		},
	},
}),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions