gpt4 book ai didi

javascript - Gatsby.js - 版式主题

转载 作者:行者123 更新时间:2023-12-02 23:54:35 24 4
gpt4 key购买 nike

我正在创建一个基于 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;

但是,当我将鼠标悬停在typography-theme-github import 上时,它带有点下划线,我得到了这个提示:

Could not find a declaration file for module 'typography-theme-github'. '/Users/jozefrzadkosz/Desktop/hello-world/node_modules/typography-theme-github/dist/index.js' implicitly has an 'any' type. Try npm install @types/typography-theme-github if it exists or add a new declaration (.d.ts) file containing declare module 'typography-theme-github';ts(7016)

当我运行 gatsbydevelop 时,我收到此错误:

Error: Unable to find plugin "undefined". Perhaps you nee d to install its package?

编辑

我查看了这个文件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 的问题。

关于javascript - Gatsby.js - 版式主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55459161/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com