Open EvHaus opened 9 months ago
It looks like a bug in ESBuild on your compile time not a runtime issue https://github.com/ardatan/graphql-tools/blob/master/packages/utils/src/debugTimer.ts#L4 If you think it is a runtime issue, could you create a reproduction on CodeSandbox? Thanks!
In my project, the error is reproduced.
Editing node_modules/.pnpm/@graphql-tools+utils@10.0.13_graphql@16.8.1/node_modules/@graphql-tools/utils/esm/debugTimer.js
fixed the error:
const debugNamesOngoing = new Set();
export function debugTimerStart(name) {
- const debugEnvVar = globalThis?.process.env['DEBUG'] || globalThis.DEBUG;
+ // ad hoc
+ const debugEnvVar = globalThis.process.env['DEBUG'] || globalThis.DEBUG;
if (debugEnvVar === '1' || debugEnvVar?.includes(name)) {
debugNamesOngoing.add(name);
console.time(name);
}
}
export function debugTimerEnd(name) {
if (debugNamesOngoing.has(name)) {
console.timeEnd(name);
}
}
UPDATE:
Install vite-plugin-replace
, then
vite.config.ts
import { replaceCodePlugin } from 'vite-plugin-replace';
// ...
export default defineConfig(({ mode, command }) => ({
plugins: [
replaceCodePlugin({
replacements: [
{
from: 'globalThis?.process.env',
to: 'globalThis.process.env',
},
],
}),
...
})
This solved the problem...
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug
After upgrading from
@graphql-tools/mock@9.0.0
to@graphql-tools/mock@9.0.1
my app builds are failing with:Rolling back to 9.0.0 makes the issue go away.
To Reproduce Steps to reproduce the behavior:
Working on it...
Expected behavior
No crash.
Environment:
@graphql-tools/mock
: 9.0.1Additional context
My app is Storybook, built via Vite.