@salesforce/webapp-template-base-react-app-experimental 1.33.3 → 1.33.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +2 -2
- package/src/force-app/main/default/webapplications/base-react-app/build/vite.config.js +2 -0
- package/src/force-app/main/default/webapplications/base-react-app/src/app.tsx +10 -1
- package/src/force-app/main/default/webapplications/base-react-app/src/appLayout.tsx +22 -2
- package/src/force-app/main/default/webapplications/base-react-app/src/routes.tsx +1 -1
- package/src/force-app/main/default/webapplications/base-react-app/vite.config.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.33.5](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.33.4...v1.33.5) (2026-02-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- base-react-app: router basename, nav layout, and import path ([#122](https://github.com/salesforce-experience-platform-emu/webapps/issues/122)) ([ad6d3e5](https://github.com/salesforce-experience-platform-emu/webapps/commit/ad6d3e5bbee84eb0b524128bbc89a0f5f7c01595))
|
|
11
|
+
|
|
12
|
+
## [1.33.4](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.33.3...v1.33.4) (2026-02-17)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-react-app-experimental
|
|
15
|
+
|
|
6
16
|
## [1.33.3](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.33.2...v1.33.3) (2026-02-17)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @salesforce/webapp-template-base-react-app-experimental
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-base-react-app-experimental",
|
|
3
|
-
"version": "1.33.
|
|
3
|
+
"version": "1.33.5",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"test:coverage": "npm run test:e2e",
|
|
16
16
|
"test:e2e": "cd src/force-app/main/default/webapplications/base-react-app && rm -rf node_modules && npm ci && npx playwright install chromium && npm run build:e2e && npx playwright test"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "d23795615e716c723701b285cf0f84a0c94ff6fe"
|
|
19
19
|
}
|
|
@@ -7,6 +7,8 @@ import salesforce from '@salesforce/vite-plugin-webapp-experimental';
|
|
|
7
7
|
export default defineConfig(function (_a) {
|
|
8
8
|
var mode = _a.mode;
|
|
9
9
|
return {
|
|
10
|
+
// Ensure root base for e2e/static serve; plugin may override when deployed under a path
|
|
11
|
+
base: '/',
|
|
10
12
|
plugins: [tailwindcss(), react(), salesforce()],
|
|
11
13
|
// Build configuration for MPA
|
|
12
14
|
build: {
|
|
@@ -4,7 +4,16 @@ import { StrictMode } from 'react';
|
|
|
4
4
|
import { createRoot } from 'react-dom/client';
|
|
5
5
|
import './styles/global.css';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// Match Vite base so client-side routes work when deployed under a path (e.g. /lwr/application/ai/c-webapp2/).
|
|
8
|
+
// When served at root (e.g. e2e with static serve), use '/' so routes match.
|
|
9
|
+
const base = (import.meta.env.BASE_URL ?? '/').replace(/\/$/, '') || '/';
|
|
10
|
+
const basename =
|
|
11
|
+
typeof window !== 'undefined' &&
|
|
12
|
+
(window.location.pathname === '/' ||
|
|
13
|
+
!window.location.pathname.startsWith('/lwr/'))
|
|
14
|
+
? '/'
|
|
15
|
+
: base;
|
|
16
|
+
const router = createBrowserRouter(routes, { basename });
|
|
8
17
|
|
|
9
18
|
createRoot(document.getElementById('root')!).render(
|
|
10
19
|
<StrictMode>
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
import { Outlet } from 'react-router';
|
|
1
|
+
import { Outlet, NavLink } from 'react-router';
|
|
2
|
+
|
|
3
|
+
const navLinkClass = ({ isActive }: { isActive: boolean }) =>
|
|
4
|
+
`text-sm font-medium ${isActive ? 'text-gray-900' : 'text-gray-600 hover:text-gray-900'}`;
|
|
2
5
|
|
|
3
6
|
export default function AppLayout() {
|
|
4
7
|
return (
|
|
5
8
|
<>
|
|
6
|
-
<
|
|
9
|
+
<nav className="sticky top-0 z-10 border-b border-gray-200 bg-white">
|
|
10
|
+
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
|
|
11
|
+
<div className="flex h-14 items-center gap-8">
|
|
12
|
+
<NavLink to="/" end className={navLinkClass}>
|
|
13
|
+
Home
|
|
14
|
+
</NavLink>
|
|
15
|
+
<NavLink to="/about" className={navLinkClass}>
|
|
16
|
+
About
|
|
17
|
+
</NavLink>
|
|
18
|
+
<NavLink to="/does-not-exist" className={navLinkClass}>
|
|
19
|
+
404
|
|
20
|
+
</NavLink>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</nav>
|
|
24
|
+
<main>
|
|
25
|
+
<Outlet />
|
|
26
|
+
</main>
|
|
7
27
|
</>
|
|
8
28
|
);
|
|
9
29
|
}
|
|
@@ -7,6 +7,8 @@ import salesforce from '@salesforce/vite-plugin-webapp-experimental';
|
|
|
7
7
|
|
|
8
8
|
export default defineConfig(({ mode }) => {
|
|
9
9
|
return {
|
|
10
|
+
// Ensure root base for e2e/static serve; plugin may override when deployed under a path
|
|
11
|
+
base: '/',
|
|
10
12
|
plugins: [tailwindcss(), react(), salesforce()],
|
|
11
13
|
|
|
12
14
|
// Build configuration for MPA
|