Skip to content

Commit

Permalink
Hotfix/fix react deployments (#283)
Browse files Browse the repository at this point in the history
* Remove external rollupOptions as not needed

core-components now uses those as peer dependencies

* Add exp-react to index.html

* Add exp-react to useBasePath.ts

* Fix lint issue
  • Loading branch information
nathanfranklin authored Nov 15, 2024
1 parent f79b0cb commit a0b9578
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@
pathname.startsWith('/dev-react')
) {
document.getElementById('base').href = '/dev-react/';
} else if (
/^hazmapper.tacc.utexas.edu/.test(hostname) &&
pathname.startsWith('/exp-react')
) {
document.getElementById('base').href = '/exp-react/';
} else if (/^hazmapper.tacc.utexas.edu/.test(hostname)) {
document.getElementById('base').href = '/hazmapper-react/';
} else if (
/* NOTE: non `-react` statements below are not being used */
/^hazmapper.tacc.utexas.edu/.test(hostname) &&
pathname.startsWith('/staging')
) {
Expand All @@ -33,6 +39,11 @@
pathname.startsWith('/dev')
) {
document.getElementById('base').href = '/dev/';
} else if (
/^hazmapper.tacc.utexas.edu/.test(hostname) &&
pathname.startsWith('/exp')
) {
document.getElementById('base').href = '/exp/';
} else if (/^hazmapper.tacc.utexas.edu/.test(hostname)) {
document.getElementById('base').href = '/hazmapper/';
} else {
Expand Down
2 changes: 2 additions & 0 deletions react/src/hooks/environment/useBasePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ const useBasePath = (): string => {
'/hazmapper-react',
'/staging-react',
'/dev-react',
'/exp-react',
'/hazmapper',
'/staging',
'/dev',
'/exp',
];
const currentPath: string = window.location.pathname;
const base: string | undefined = paths.find((path) =>
Expand Down
1 change: 0 additions & 1 deletion react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default defineConfig(({ command, mode }) => {
},
build: {
rollupOptions: {
external: ['react', 'react-dom', 'react-router-dom'], // Ensure these are treated as external
output: {
manualChunks(id) {
if (id.includes('node_modules/react-datepicker')) {
Expand Down

0 comments on commit a0b9578

Please sign in to comment.