routerBaseName
Migration Guide: Router Configuration (routerBasename
and PUBLIC_URL
)
Key Changes:
routerBasename
Default Value: The recommended default value forrouterBasename
in the configuration file (window.config
) has changed from'/'
tonull
.- New Default Behavior: If
routerBasename
is 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
routerBasename
Configuration: Locate therouterBasename
setting within your application configuration file (typically found inplatform/app/public/config/*.js
). -
Update
routerBasename
Based 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 updaterouterBasename
tonull
. This aligns the routing base with the default asset loading path (PUBLIC_URL
which defaults to/
).Example Diff:
window.config = {
- routerBasename: '/',
+ routerBasename: null,
// ... other config options
showStudyList: true,
dataSources: [ /* ... */ ],Explanation: Setting
routerBasename: null
leverages the new default behavior. The router will use/
as its base becausePUBLIC_URL
defaults 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 ensurerouterBasename
is 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
routerBasename
ensures the application's internal routing works correctly under the/viewer/
path.
-