Project setup
yarn install
Compiles and hot-reloads for development
yarn serve
Compiles and minifies for production
yarn build
Lints and fixes files
yarn lint
Add a profile in the public directory
Src directory of the project is the development directory, the code is developed in this directory;
public
directory is stored in those files do not need to pack our common path to that file is placed in this directory.
New File /public/serverConfig.json
file
{
"baseURL":"http://127.0.0.1:8888/api/private/v1"
}
The basic content of the document written on the path, or other profile parameters can be.
After the package will /dist
file folder generated serverConfig.json
, so you can not modify the configuration when re-packaged
Solve vue cli3.0 packaged on-line static resources can not find the path problem
Project after encountering packaged static resource path can not be found, reported the following error:
The solution:
to create in the root directory of the project vue.config.js
file, configure static resources on the inside path publicPath
is the path to configure a static resource properties, vue.config.js
code file as follows:
module.exports = {
publicPath: './'
}
Packed file
yarn build
After the package file directory
The dist directory on the server back to the pack on the line