Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

config-base

Deploy html to a non-root directory

Users frequently ask the question:

Why does my local development environment look good, but after deploying to production, there is no response, and there are no errors reported?

This commonly happens when the application is deployed to a non-root path. Why does this happen? In a nutshell it is because the route does not match: when you deploy the application under /xxx/, and then visit /xxx/hello, the code matches /hello, which will not match, and since the fallback route is not defined, such as a 404, a blank page will be displayed instead.

How can you fix this?

To fix this issue, you can configure the base path:

export default {
  base: '/path/to/your/app/root',
};

How to use

Execute @umijs/create-umi-app with npm or Yarn to bootstrap the example:

npx @umijs/create-umi-app --example config-base config-base-app
# or
yarn create @umijs/umi-app --example config-base config-base-app