boolean | string
'/'
Set the URL prefix of static assets in the development environment.
assetPrefix
will affect the URLs of most of the static assets, including JavaScript files, CSS files, images, videos, etc. If an incorrect value is specified, you'll receive 404 errors while loading these resources.
This config is only used in the development environment. In the production environment, please use the output.assetPrefix
to set the URL prefix.
If assetPrefix
is set to true
, the URL prefix will be http://localhost:port/
:
The script URL will be:
If assetPrefix
is set to false
or not set, /
is used as the default value.
When the value of assetPrefix
is string
type, the string will be used as the URL prefix:
The script URL will be:
dev.assetPrefix
corresponds to the following native configurations:
The differences from the native configuration are as follows:
dev.assetPrefix
only takes effect in the development environment.dev.assetPrefix
automatically appends a trailing /
by default.dev.assetPrefix
is written to the process.env.ASSET_PREFIX
environment variable.