string
/
>= 1.0.10
server.base
is used to configure the base path of the server.
By default, the Rsbuild server's base path is /
. You can access output files like index.html
and assets in the public folder through http://localhost:3000/
.
If you want to access index.html
through http://localhost:3000/foo/
, you can change server.base
to /foo
.
export default {
server: {
base: '/foo',
},
};
dev.assetPrefix and output.assetPrefix will read the value of server.base
as the default value.
When server.base
is /foo
, the default resource URL loaded in the browser is as follows:
<script defer src="/foo/static/js/index.js"></script>
Then, index.html
and static assets can be accessed through http://localhost:3000/foo/
.
If you do not want to use this default behavior, you can override it by explicitly setting dev.assetPrefix
/ output.assetPrefix
:
export default {
dev: {
assetPrefix: '/',
},
output: {
assetPrefix: 'https://cdn.example.com/assets/',
},
server: {
base: '/foo',
},
};