File tree Expand file tree Collapse file tree 5 files changed +26
-28
lines changed
templates/react/{{cookiecutter.project_slug}}
backend/{{cookiecutter.module_name}}/api Expand file tree Collapse file tree 5 files changed +26
-28
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,10 @@ build-frontend: # Build the React app
4343 @if [ ! -d " $( FRONTEND_FOLDER) /node_modules" ]; then \
4444 $(MAKE ) install-frontend; \
4545 fi
46- cd $(FRONTEND_FOLDER ) ; rm -rf build && REACT_APP_DEVELOPMENT_ENVIRONMENT=false NODE_ENV=prod npm run build
46+ cd $(FRONTEND_FOLDER ) ; rm -rf build && NODE_ENV=prod npm run build
4747
4848start-frontend : # # Start the frontend in dev mode (hot reload)
49- cd $(FRONTEND_FOLDER ) ; REACT_APP_DEVELOPMENT_ENVIRONMENT=true yarn start
49+ cd $(FRONTEND_FOLDER ) ; yarn start
5050
5151install : venv install-backend install-frontend # # Install dependencies
5252
Original file line number Diff line number Diff line change 1- from localstack .http import route , Request , Response
1+ import logging
2+
3+ from localstack .http import Request , Response , route
24
35from .. import static
46
7+ LOG = logging .getLogger (__name__ )
8+
9+
510class WebApp :
611 @route ("/" )
712 def index (self , request : Request , * args , ** kwargs ):
813 return Response .for_resource (static , "index.html" )
9-
14+
1015 @route ("/<path:path>" )
1116 def index2 (self , request : Request , path : str , ** kwargs ):
12- return Response .for_resource (static , path )
17+ try :
18+ return Response .for_resource (static , path )
19+ except Exception :
20+ LOG .debug (f"File { path } not found, serving index.html" )
21+ return Response .for_resource (static , "index.html" )
Original file line number Diff line number Diff line change 88 "@emotion/styled" : " ^11.11.5" ,
99 "@localstack/integrations" : " ^1.0.0" ,
1010 "@mui/material" : " ^5.15.20" ,
11- "@testing-library/react" : " ^13.4.0" ,
12- "@types/node" : " ^16.18.99" ,
13- "@types/react-dom" : " ^17.0.11" ,
1411 "react" : " ^17.0.2" ,
1512 "react-dom" : " ^17.0.2" ,
1613 "react-router-dom" : " ^6.24.0" ,
1916 },
2017 "devDependencies" : {
2118 "@esbuild-plugins/node-modules-polyfill" : " ^0.1.4" ,
19+ "@testing-library/react" : " ^13.4.0" ,
20+ "@types/node" : " ^16.18.99" ,
21+ "@types/react" : " ^19.1.6" ,
22+ "@types/react-dom" : " ^17.0.11" ,
2223 "concurrently" : " ^8.2.2" ,
2324 "esbuild" : " ^0.16.6" ,
2425 "esbuild-envfile-plugin" : " ^1.0.2" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- import ReactDOM from 'react-dom' ;
2- import './index.css' ;
3- import { CustomRoutes } from './CustomRoutes' ;
4- import { BrowserRouter } from 'react-router-dom' ;
5- import { LocalStackThemeProvider } from '@localstack/integrations'
6- import { DEVELOPMENT_ENVIRONMENT } from './constants' ;
7-
8- const EXTENSION_NAME = '{{cookiecutter.project_slug}}'
9-
10- const getBaseName = ( ) => {
11- if ( window . location . origin . includes ( EXTENSION_NAME ) || DEVELOPMENT_ENVIRONMENT ) {
12- return '' ;
13- }
14-
15- return `/_extension/${ EXTENSION_NAME } ` ;
16- } ;
1+ import ReactDOM from "react-dom" ;
2+ import "./index.css" ;
3+ import { CustomRoutes } from "./CustomRoutes" ;
4+ import { HashRouter } from "react-router-dom" ;
5+ import { LocalStackThemeProvider } from "@localstack/integrations" ;
176
187ReactDOM . render (
198 < LocalStackThemeProvider useExtensionLayout >
20- < BrowserRouter basename = { getBaseName ( ) } >
9+ < HashRouter >
2110 < CustomRoutes />
22- </ BrowserRouter >
11+ </ HashRouter >
2312 </ LocalStackThemeProvider > ,
24- document . getElementById ( ' root' ) ,
13+ document . getElementById ( " root" )
2514) ;
You can’t perform that action at this time.
0 commit comments