我用的是tailwin css,本地字体存放在public文件夹里面,其他配置如下:
@font-face {
font-family: "GAS";
src: url("/fonts/gas.TTF");
}
@font-face {
font-family: "MONUMENT";
src: url("/fonts/monument.otf");
}
@font-face {
font-family: "UNIVERSE";
src: url("/fonts/universe.otf");
}
extend: {
fontFamily: {
gas: "GAS",
universe: "UNIVERSE",
monument: "MONUMENT"
}}
const nextConfig = {
reactStrictMode: false,
assetPrefix: ".",
images: {
unoptimized: true
},
async redirects() {
return [
{
source: '/',
destination: '/home',
permanent: true
},
]
},
}
现在这些字体在本地工作正常,但是当我部署构建时,由于路径错误而无法加载字体:
路径来了:http://dev-games-rgs.sportsit-tech.net/fonts/universe.otf 路径应该来了:http://dev-games-rgs.sportsit-tech.net/games/crash/fonts/universe.otf
尽管我配置了“assetPrefix”,但它似乎不适用于 css 文件。一些帮助将不胜感激。