1. Open the command line in the project directory (the same directory as the project's package.json file).
Note: package.json contains the configuration items needed for the project to run, and will be loaded when the project is compiled and run
2. Execute the command
vue project: npm run dev will start the project immediately in the development environment
react project: npm run start will start the project immediately in the development environment
npm run build compile and package the project
The command executed here is also the script information marked in package.json. If the command prompt is wrong, you can open the package.json file to check the executable script information you need.
3. After executing the compile command, the dist folder will be generated in the project directory, and the compiled front-end file is placed inside, and indexl.html is the project entrance.
4. When you open index.html with a browser, you will find that nothing will be displayed. When you use F12 to open the debug bar, you will find that the console error.
/
5. This is a problem of referencing the resource path. We can open the config / index.js file under the project and find the following properties to make changes
The actual change here is to change the default absolute path to a relative path. If you do not modify it, you can directly access the files in dist by placing them in the server root directory.
6. Recompile and open the file