How does vue-cli3 solve the root directory problem (independent of the server)?

< H1 > Note, it"s the scaffolding of cli3 < / H1 >.

A small project currently being done is completely independent of the network environment (offline)
, so there is no room for localhost and so on.

A local service is opened during development, so everything is fine

but there is a path problem after build
for example:

<script src=/js/app.0db279ae.js></script>

this path will be parsed to

by the browser.
file:///js/app.0db279ae.js

mm-hmm.

so it can only be written as a relative path

<script src=js/app.0db279ae.js></script>

the question is, how do you configure it?
looked it up on the Internet, but I couldn"t find any valid information, so I came to ask for advice.

May.22,2021

find publicPath, in build/config.js and fill in your root directory url or CDN prefix.


  1. create a vue.config.js file under the root directory, as shown in the following figure
    clipboard.png
  2. :
    clipboard.png
  3. copy to the configured directory and visit index.html
vue-cli3 official documentation: https://cli.vuejs.org/zh/conf.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c78c-2ba93.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c78c-2ba93.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?