Home > @lynx-js/rspeedy > Dev > assetPrefix
Dev.assetPrefix property
The Dev.assetPrefix is used to set the URL prefix for static assets during development.
Signature:
Remarks
The functionality of Dev.assetPrefix is basically the same as the output.publicPath config in Rspack. With the following differences:
-
dev.assetPrefixonly takes effect during development. -
dev.assetPrefixautomatically appends a trailing/by default. -
The value of
dev.assetPrefixis written to theprocess.env.ASSET_PREFIXenvironment variable.
Example 1
If dev.assetPrefix is set to true, the URL prefix will be http://<host>:<port>/:
Example 2
If dev.assetPrefix is set to a string, the value will be used as a prefix and automatically appended to the static resource URL.
Example 3
The port number that Rspeedy server listens on may change. For example, if the port is in use, Rspeedy will automatically increment the port number until it finds an available port.
To avoid dev.assetPrefix becoming invalid due to port changes, you can use one of the following methods:
-
Enable
server.strictPort. -
Use the
<port>placeholder to refer to the current port number. Rspeedy will replace the placeholder with the actual port number it is listening on.

