【发布时间】:2023-04-03 01:15:01
【问题描述】:
我正在将 NextJS 项目与 MUI 一起使用,并且我正在尝试使用 theme 函数中的 theme 设置来设置 fontWeight 属性。只有在 docker 容器内构建时才会发生错误。在本地构建工作正常。
export const useTableStyles = makeStyles(theme =>
createStyles({
spannedTableCell: {
fontWeight: theme.typography.fontWeightBold
}
})
);
但是,当我的 docker 容器正在构建时,我收到以下错误:
我在容器和本地都使用节点 v16.13.0
容器(node:lts-alpine3.12):
本地:
这是typography 主题设置:
typography: {
fontFamily: '"Roboto", serif',
fontSize: 16,
fontWeightLight: 300,
fontWeightRegular: 400,
fontWeightMedium: 500,
fontWeightBold: 700,
htmlFontSize: 16
},
我使用的 MUI 版本
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@material-ui/pickers": "^3.3.10",
编辑:
我将硬编码的值更改为bold、normal 等,现在它可以正常工作了
【问题讨论】:
-
这很可能是由于某些软件包的不同版本造成的。你能发布你的
package.json文件吗?
标签: reactjs typescript docker material-ui next.js