vue3.0 yarn project start

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;
publicdirectory 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.jsonfile

{
    "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 /distfile 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.jsfile, configure static resources on the inside path publicPathis the path to configure a static resource properties, vue.config.jscode 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

Guess you like

Origin www.cnblogs.com/haima/p/12499281.html