[英]Gatsby.js default starter site not updating on typography.js changes
[英]Gatsby.js - Typography themes
我正在基于gatsby框架创建应用程序,但是初始化gatsby主题时遇到问题。 根据官方文档:
https://www.gatsbyjs.org/tutorial/part-three/
import Typography from 'typography';
import fairyGateTheme from 'typography-theme-github';
const typography = new Typography(fairyGateTheme);
export const { scale, rhythm, options } = typography;
export default typography;
但是,当我将鼠标悬停在它上时,typeography-theme-github导入已用下划线标出:
找不到模块“ typography-theme-github”的声明文件。 “ /Users/jozefrzadkosz/Desktop/hello-world/node_modules/typography-theme-github/dist/index.js”隐式具有“ any”类型。 尝试
npm install @types/typography-theme-github
如果存在)或添加一个包含declare module 'typography-theme-github';
的新声明(.d.ts)文件declare module 'typography-theme-github';
ts(7016)
当我运行gatsby develop
此错误:
错误:找不到插件“未定义”。 也许您需要安装其软件包?
编辑
我查看了这个文件node_modules/typography-theme-github/dist/index.js
,发现了一个类似的问题:
var _grayPercentage = require("gray-percentage");
这与我的主题导入有完全相同的技巧。
第二编辑
Gatsby.config.js
module.exports = {
plugins: [
[`gatsby-plugin-sass`],
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`
}
}
]
};
我注意到您将gatsby-plugin-sass
放置在一个数组中,这就是为什么gatsby
无法识别它的原因:
module.exports = {
plugins: [
- [`gatsby-plugin-sass`], <-- error
+ `gatsby-plugin-sass`,
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`
}
}
]
};
gatsby-plugin-typography
可能不是问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.