PublicPath is required in prod mode.
Cause
When building an Rspress producer, the project needs to set publicPath
, otherwise it cannot be loaded normally by other consumers.
Solution
Set publicPath
. You can set it in the following ways:
rspress.config.ts
export default {
builderConfig: {
output: {
assetPrefix: 'https://module-federation.io/',
}
}
}
rspress.config.ts
export default {
builderConfig: {
tools: {
rspack: (config)=>{
config.output.publicPath = 'https://module-federation.io/';
},
}
}
}