Closed5

relay-compilerのTypeScriptの設定

HaruHaru

エラー

relay-compilerがTypeScriptだとデフォルトではコンパイルできない。

$ yarn run relay-compiler $@
[INFO] [default] compiling...
thread 'main' panicked at 'Expect GraphQLAsts to exist.', /Users/runner/work/relay/relay/compiler/crates/relay-compiler/src/compiler.rs:333:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error Command failed with exit code 101.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 101.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 101.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: command finished with error: command (typescript/apps/moet) yarn run dev exited (101)

Rustのbacktraceをfullにしたエラーも一応載せておく

export RUST_BACKTRACE=full
$ yarn run relay-compiler $@
[INFO] [default] compiling...
thread 'main' panicked at 'Expect GraphQLAsts to exist.', /Users/runner/work/relay/relay/compiler/crates/relay-compiler/src/compiler.rs:333:18
stack backtrace:
 0:        0x105a9b3c1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h428cf6d3383daa9c
 1:        0x105abadbb - core::fmt::write::hcf88e896ec23e052
 2:        0x105a931ea - std::io::Write::write_fmt::h58c3052bb04c456d
 3:        0x105a9cc55 - std::panicking::default_hook::{{closure}}::h99b76afd6b358916
 4:        0x105a9c83f - std::panicking::default_hook::hd7fbc9eda5da2259
 5:        0x105a9d340 - std::panicking::rust_panic_with_hook::h48eeb24de18c027c
 6:        0x105a9cdde - std::panicking::begin_panic_handler::{{closure}}::h1cb76dc2cf734090
 7:        0x105a9b837 - std::sys_common::backtrace::__rust_end_short_backtrace::h6ba95b68f495d865
 8:        0x105a9cd4a - _rust_begin_unwind
 9:        0x105b1733f - core::panicking::panic_fmt::h91749835f0f98da6
10:        0x105ab8bdb - core::panicking::panic_display::hf0a2eae2e90d19f4
11:        0x105b1724c - core::option::expect_failed::h1f0ed0daf61fb54f
12:        0x105411112 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h9c35114850f55cd2
13:        0x105416f87 - relay::main::{{closure}}::hf4d61b2038722b32
14:        0x10548490c - tokio::park::thread::CachedParkThread::block_on::ha3ba9dc5810242c2
15:        0x10542f959 - tokio::runtime::thread_pool::ThreadPool::block_on::h8f9889f953d4d5ec
16:        0x1054a50a9 - tokio::runtime::Runtime::block_on::h1fe6db651c7af865
17:        0x10544660e - relay::main::h732da15c95056b5f
18:        0x10547b246 - std::sys_common::backtrace::__rust_begin_short_backtrace::hb87d83b6bb06c797
19:        0x10548ca3c - std::rt::lang_start::{{closure}}::h998954499eae12ee
20:        0x105a9b06f - std::rt::lang_start_internal::h240e1720b3cdfa5e
21:        0x105446769 - _main
HaruHaru

relay-compilerの言語をTypeScriptに指定

relay.config.js を用意する。
引数なしの実行でこのrelay.config.jsを読み込んでくれる。

v13.2.0ではデフォルトがFlowなので、TypeScriptを指定。

module.exports = {
  language: "typescript",
  schema: "./schema.graphql",
  src: "./src/",
};

またデフォルトがFlowだったりTypeScriptだったりバージョンで変更されたりしているので、
とりあえず指定しておくのが確実。

このスクラップは2023/01/23にクローズされました