Skip to content

Commit b7f04db

Browse files
committed
Setup working routing and prepare the app for deploy.
1 parent fb6e345 commit b7f04db

File tree

5 files changed

+30
-11
lines changed

5 files changed

+30
-11
lines changed

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
"version": "0.1.0",
44
"private": true,
55
"type": "module",
6+
"scripts": {
7+
"start": "vite",
8+
"build": "tsc -b && vite build",
9+
"preview": "vite preview",
10+
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
11+
"test": "vitest"
12+
},
613
"dependencies": {
714
"@igniteui/material-icons-extended": "^3.0.0",
815
"@testing-library/jest-dom": "^6.1.3",
@@ -35,13 +42,6 @@
3542
"vite": "^4.4.9",
3643
"vitest-canvas-mock": "^0.3.3"
3744
},
38-
"scripts": {
39-
"start": "vite",
40-
"build": "tsc && node --max-old-space-size=4096 node_modules/vite/bin/vite build",
41-
"preview": "vite preview",
42-
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
43-
"test": "vitest"
44-
},
4545
"browserslist": [
4646
">0.2%",
4747
"not dead",

public/web.config

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<configuration>
3+
<system.webServer>
4+
<rewrite>
5+
<rules>
6+
<rule name="React Routes" stopProcessing="true">
7+
<match url=".*" />
8+
<conditions logicalGrouping="MatchAll">
9+
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
10+
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
11+
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
12+
</conditions>
13+
<action type="Rewrite" url="/react-grid-examples/" />
14+
</rule>
15+
</rules>
16+
</rewrite>
17+
</system.webServer>
18+
</configuration>

src/app/views/home/home-view.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ export default function HomeView() {
115115
],
116116
]);
117117
const location = useLocation();
118-
const [gridView, setGridView] = useState("/inventory")
118+
const [gridView, setGridView] = useState("inventory");
119119

120120
useEffect(() => {
121121
registerIcon("file_download", FILE_DOWNLOAD, "custom");
122122
}, []);
123123

124124
useEffect(() => {
125-
setGridView(location.pathname.replace("/home", ""));
125+
setGridView(location.pathname.replace("/home/", ""));
126126
}, [location]);
127127

128128
return (
@@ -137,7 +137,7 @@ export default function HomeView() {
137137
)}
138138
</div>
139139
<div className="router-container">
140-
<iframe src={gridView} height='100%' width='100%' style={{ border: 0 }}/>
140+
<iframe src={import.meta.env.BASE_URL+ gridView} height='100%' width='100%' style={{ border: 0 }}/>
141141
</div>
142142
</div>
143143
);

src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import App from './app/app';
55
import { routes } from "./app/app-routes";
66
import 'react-app-polyfill/ie11';
77

8-
const basename = import.meta.env.VITE_BASENAME || '/';
8+
const basename = import.meta.env.BASE_URL || '/';
99

1010
/** Required in IE11 for Charts */
1111
Number.isNaN = Number.isNaN || function(value) {

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import react from '@vitejs/plugin-react'
44

55
// https://vitejs.dev/config/
66
export default defineConfig({
7+
base: '/react-grid-examples/',
78
build: {
89
chunkSizeWarningLimit: 10 * 1024 * 1024, // 10 MB
910
},

0 commit comments

Comments
 (0)