routerBaseName
Migration Guide: Router Configuration (routerBasename and PUBLIC_URL)​
Key Changes:
routerBasenameDefault Value: The recommended default value forrouterBasenamein the configuration file (window.config) has changed from'/'tonull.- New Default Behavior: If
routerBasenameis set tonull(or is not defined) in the configuration, the application's base path will now automatically default to the value determined byPUBLIC_URL. - Clarified Roles:
routerBasename: Explicitly defines the base path for the application's routes (e.g.,/viewer). Ifnull, it defaults toPUBLIC_URL.PUBLIC_URL: Primarily defines the URL prefix from which static assets (like JavaScript files, CSS, images) are loaded. It defaults to/if not set.
see the comprehensive guide here
Migration Steps:
-
Review
routerBasenameConfiguration: Locate therouterBasenamesetting within your application configuration file (typically found inplatform/app/public/config/*.js). -
Update
routerBasenameBased on Hosting Scenario:-
Scenario A: Hosting at the Root (
/) If your application is served from the root domain (e.g.,https://example.com/), it's recommended to updaterouterBasenametonull. This aligns the routing base with the default asset loading path (PUBLIC_URLwhich defaults to/).Example Diff:
window.config = {
- routerBasename: '/',
+ routerBasename: null,
// ... other config options
showStudyList: true,
dataSources: [ /* ... */ ],Explanation: Setting
routerBasename: nullleverages the new default behavior. The router will use/as its base becausePUBLIC_URLdefaults to/. -
Scenario B: Hosting at a Subpath (e.g.,
/viewer/) If your application is served from a subpath (e.g.,https://example.com/viewer/), you should ensurerouterBasenameis explicitly set to that path.Example (No Change Needed if Already Correct):
window.config = {
// No change needed if already set correctly for subpath hosting
routerBasename: '/viewer',
// ... other config options
showStudyList: true,
dataSources: [ /* ... */ ],Explanation: Explicitly setting
routerBasenameensures the application's internal routing works correctly under the/viewer/path.
-