logologo
Guide
Practice
Configuration
Plugins
Showcase
Blog
Ecosystem
Module Federation Examples
Practical Module Federation
Zephyr Cloud
Nx
简体中文
English
Guide
Practice
Configuration
Plugins
Showcase
Blog
Module Federation Examples
Practical Module Federation
Zephyr Cloud
Nx
简体中文
English
logologo

Getting Started

Introduction
Setting Up the Environment
Quick Start Guide
Feature Navigation
Glossary of Terms
npm Packages

basic

Runtime

Runtime Access
Runtime API
Runtime Hooks
Rsbuild Plugin
Rspack Plugin
Webpack Plugin
Rspress Plugin
Vite Plugin
Metro
Type Hinting
Command Line Tool
Style Isolation

Data Solution

Data Fetching
Data Caching
Prefetch

Frameworks

Modern.js
Next.js

Deployment

Deploy with Zephyr Cloud

Debug

Enable debug mode
Chrome DevTools
Global variables

Troubleshooting

Overview

Runtime

RUNTIME-001
RUNTIME-002
RUNTIME-003
RUNTIME-004
RUNTIME-005
RUNTIME-006
RUNTIME-007
RUNTIME-008
RUNTIME-009

Build

BUILD-001
BUILD-002

Type

Overview
TYPE-001
Other
Edit this page on GitHub
Previous PageBUILD-001
Next PageOverview

PublicPath is required in prod mode.

  • Error Code: BUILD-002

#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:

  • Set builderConfig.output.assetPrefix in rspress.config.ts
rspress.config.ts
export default {
  builderConfig: {
    output: {
      assetPrefix: 'https://module-federation.io/',
    }
  }
}
  • Set builderConfig.tools.rspack in rspress.config.js
rspress.config.ts
export default {
  builderConfig: {
    tools: {
      rspack: (config)=>{
        config.output.publicPath = 'https://module-federation.io/';
      },
    }
  }
}