【问题标题】:Gatsby Transitions with AniLink - not working使用 AniLink 的 Gatsby 转换 - 不工作
【发布时间】:2019-12-15 00:27:47
【问题描述】:

刚刚尝试了 AniLink,但该软件包似乎存在一些问题。测试链接似乎不起作用,并且导入似乎也引发了错误:

Could not find a declaration file for module 'gatsby-plugin-transition-link/AniLink'. '/Users/robert/Software/bDev/evu/node_modules/gatsby-plugin-transition-link/AniLink/index.js' implicitly has an 'any' type.
  Try `npm install @types/gatsby-plugin-transition-link` if it exists or add a new declaration (.d.ts) file containing `declare module 'gatsby-plugin-transition-link/AniLink';`ts(7016)

该组件是一个在布局组件中使用的banner.js 文件。

我导入 AniLink:

import AniLink from 'gatsby-plugin-transition-link/AniLink';

并尝试使用它但没有任何反应:

<AniLink fade to="allProducts">View Now</AniLink> // or to="/allProducts"

我的配置文件:

module.exports = {
  siteMetadata: {
    title: `EssentialVu`,
    description: `Some really sweet ecommerce site.`,
    author: `@gatsbyjs`,
  },

  plugins: [
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-stripe`,
    {
      resolve: `gatsby-source-stripe`,
      options: {
        objects: ["Sku"],
        secretKey: process.env.STRIPE_SECRET_KEY,
        downloadFiles: true,
      },
    },
    {
      resolve: "gatsby-plugin-transition-link",
      options: {
          layout: require.resolve(`./src/components/layout.js`)
        },
    }
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    },
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],

}

我也安装了 gsap:"gsap": "^2.1.3",

【问题讨论】:

    标签: gatsby


    【解决方案1】:

    你试过了吗?

    npm install @types/gatsby-plugin-transition-link
    

    【讨论】:

    • 我也遇到了这个问题,这似乎无法解决。返回 E404 错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-12
    • 2018-07-21
    • 1970-01-01
    • 1970-01-01
    • 2019-06-14
    • 1970-01-01
    • 2019-09-23
    相关资源
    最近更新 更多