微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Gatsby 开发/构建时有什么方法可以显示警告吗?

如何解决Gatsby 开发/构建时有什么方法可以显示警告吗?

我正在使用 React 进行 gatsby 项目。当 gatsby 开发或 gatsby 构建时,我能够看到所有警告,但控制台不再显示警告。我没有更改与此相关的任何设置。有谁知道如何解决这个问题?谢谢。

console when gatsby build

解决方法

好吧,你应该改变什么。可能是与 ESLint 配置相关的任何内容。

如果您在项目的根目录中运行 gatsby --help(或 gatsby -h),您将看到所有可用的命令,如下所示:

  gatsby develop                      Start development server. Watches files,rebuilds,and hot reloads if something changes
  gatsby build                        Build a Gatsby project.
  gatsby serve                        Serve previously built Gatsby site.
  gatsby info                         Get environment information for debugging and issue reporting
  gatsby clean                        Wipe the local gatsby environment including built assets and cache
  gatsby repl                         Get a node repl with context of Gatsby environment,see
                                      (https://www.gatsbyjs.com/docs/gatsby-repl/)
  gatsby recipes [recipe]             [EXPERIMENTAL] Run a recipe
  gatsby plugin <cmd> [plugins...]    Useful commands relating to Gatsby plugins
  gatsby new [rootPath] [starter]     Create new Gatsby project.
  gatsby telemetry                    Enable or disable Gatsby anonymous analytics collection.
  gatsby options [cmd] [key] [value]  View or set your gatsby-cli configuration settings.

Options:
  --verbose                Turn on verbose output                                                       [boolean] [default: false]
  --no-color,--no-colors  Turn off the color in output                                                 [boolean] [default: false]
  --json                   Turn on the JSON logger                                                      [boolean] [default: false]
  -h,--help               Show help                                                                                     [boolean]
  -v,--version            Show the version of the Gatsby CLI and the Gatsby package in the current project              [boolean]

所以,你可以运行:

gatsby develop --verbose

打开详细输出并查看详细日志。

正如我所说,你需要区分浏览器的日志和 Node 终端日志,浏览器会提示一些日志(客户端的),关于 React 和 JavaScript 的所有内容。虽然其他一些(服务器端日志)只会由终端提示,但这些是指与 Node、GraphQL 等相关的内容。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。