Weird Vinxi dev issue

Anytime I call/use this function, it seems to completely break vinxi's build in dev and throws a crazy weird error.
3 Replies
Kooki Kodes
Kooki KodesOP3w ago
Using the: "getOperationName" function anywhere within my code breaks vinxi.
export type ExtractOperationName<T extends string> =
T extends `${infer _}${"query" | "mutation"} ${infer Name}(${infer _}) {${infer _}`
? Name
: T extends `${infer _}${"query" | "mutation"} ${infer Name} {${infer _}`
? Name
: never;

export function getOperationName<const Operation extends string>(
operation: Operation,
): ExtractOperationName<Operation> {
const match = operation.match(/\b(query|mutation)\b\s+(\w+)/);
if (!match) {
throw new Error(`Operation name not found in operation: ${operation}`);
}
return match[2] as ExtractOperationName<Operation>;
}
export type ExtractOperationName<T extends string> =
T extends `${infer _}${"query" | "mutation"} ${infer Name}(${infer _}) {${infer _}`
? Name
: T extends `${infer _}${"query" | "mutation"} ${infer Name} {${infer _}`
? Name
: never;

export function getOperationName<const Operation extends string>(
operation: Operation,
): ExtractOperationName<Operation> {
const match = operation.match(/\b(query|mutation)\b\s+(\w+)/);
if (!match) {
throw new Error(`Operation name not found in operation: ${operation}`);
}
return match[2] as ExtractOperationName<Operation>;
}
This is more or less the error it throws.
[vite] Internal server error:
./node_modules/.vinxi/client/deps/chunk-RLWJ43YW.js: Unexpected token, expected "=>" (2110:10)

2108 | resolve(exitDie(e));
2109 | }
> 2110 | }) : async((resolve) => {
| ^
2111 | try {
2112 | ;
2113 | evaluate().then((a) => resolve(exitSucceed(a)), (e) => resolve(exitDie(e)));
Plugin: solid
File: ./node_modules/.vinxi/client/deps/chunk-RLWJ43YW.js?v=5a60b639:1182:11
[vite] Internal server error:
./node_modules/.vinxi/client/deps/chunk-RLWJ43YW.js: Unexpected token, expected "=>" (2110:10)

2108 | resolve(exitDie(e));
2109 | }
> 2110 | }) : async((resolve) => {
| ^
2111 | try {
2112 | ;
2113 | evaluate().then((a) => resolve(exitSucceed(a)), (e) => resolve(exitDie(e)));
Plugin: solid
File: ./node_modules/.vinxi/client/deps/chunk-RLWJ43YW.js?v=5a60b639:1182:11
bigmistqke
bigmistqke3w ago
i would add an issue in vinxi github
Kooki Kodes
Kooki KodesOP3w ago
Yeah I figured I'd need to do that xD
Want results from more Discord servers?
Add your server