incubator-answer
                                
                                
                                
                                    incubator-answer copied to clipboard
                            
                            
                            
                        fix: if PUBLIC_URL setted, static resources cannot be fetched from the backend.
Bug Reproduction Steps
- Modify the 
PUBLIC_URLin theui/.env.productionfile: 
  TSC_COMPILE_ON_ERROR=true
  ESLINT_NO_DEV_ERRORS=true
  PUBLIC_URL = /forum
  REACT_APP_API_URL = /
- Recompile
 
  make ui
  make build
- Execute the initialization command:
 
INSTALL_PORT=9080 ./answer init -C ./answer-data/
- Access the initialization configuration page at 
http://localhost:9080/installand encounter the following error. 

Bug Resolution
During initialization and runtime, it is necessary to add the environment variable PUBLIC_URL.
# Initialization
INSTALL_PORT=9080 PUBLIC_URL=/forum ./answer init -C ./answer-data/
# Run
PUBLIC_URL=/forum ./answer run -C ./answer-data/
Note:
- If the value of
 PUBLIC_URLis the default/, there is no need to set the environment variable.- The value of
 PUBLIC_URLmust not end with/. For example,PUBLIC_URL=/forumis correct, whilePUBLIC_URL=/forum/is incorrect.